6

Except under unusual circumstances, classes are things or entities -- hence the term objects -- while functions or methods are actions or operations. You want to name them accordingly. For that reason, Get_labels strikes me as an oddly named class. Based on what you've shown us, I might suggest the name Bounds as an alternative. A side benefit of that name ...


5

Keep it simple Use the KISS principle, and don't make things more complicated than necessary. Using more language features should not be a goal in itself. Also, don't add more things in a class than necessary. Why do you keep track of dimension? Nothing inside the class makes use of it. The dimension is a property of PointType and VectorType, so it's already ...


3

Value Objects The following shows what most users would consider unexpected behaviour: from ccomplex import Complex a = Complex(5, 4) + Complex(3) b = a a.re = -a.re print(b) # "-8 + 4i" Values are usually considered to be immutable. Since Python uses objects to represent values, and objects have identity which can be shared, the best practice ...


3

Looks pretty good. I see you implemented modulus in mod. It's also called absolute value, and that's the name Python uses. If you implement __abs__, then Python's abs function can use it. Then abs(Complex(3, 4)) would give you 5.0. Just like Python's own abs(3 + 4j) does. Another useful one is __bool__, which lets you declare zero as false, as is standard in ...


2

Your implementations of convertTypeToString and dimensionAsString are a little inefficient and unnatural. First, there is no need to use a variable inside the function which you assign to and finally return. Second, you should not represent an unknown or nonacceptable value as a string. Think about it from a user perspective - it's not nice (nor robust to ...


2

mystrdup() has a short-coming: to be *nix-like, I'd expect detecting cases that may set errno. IMO, use malloc() and copy the null character too. From When is it a good idea to use strdup (vs malloc / strcpy) #include <errno.h> #include <stdlib.h> char *mystrdup(const char *s) { // Optional test, s should point to a string if (s == NULL) { ...


2

The files common_unit_test_logic.* are too complex. The common_unit_test_logic .c file and header file do not follow the Single Responsibility Principle that states … that every module, class, or function should have responsibility over a single part of the functionality provided by the software, and that responsibility should be entirely encapsulated by ...


2

typedef struct can reuse the name of struct I see you often do something like: typedef struct foo_bar { ... } Foo_Bar; It's a bit weird to use lower_case for the struct name and Upper_Case for the typedef. You can reuse the same name as the struct: typedef struct foo_bar { ... } foo_bar; It's also common to append _t to the typedef'ed name so it is ...


2

Small review. Minor Simplify. Instead of unsigned char* input = (unsigned char*)"0123456789ABCDEFXabcdefx"; // size is currently 24 #define MAX_INPUT_CHARACTERS 24 State_Transition_Characters expected_transition[MAX_INPUT_CHARACTERS]; ... #undef MAX_INPUT_CHARACTERS Consider unsigned char input[] = "0123456789ABCDEFXabcdefx"; ...


2

"%z..." Avoid UB. Codes use "%zd" with size_t and unsigned. Use "%zu" with size_t and "%u" with unsigned. Name space (Is the code readable?) lexical_analyzer.h introduces types and macros such as SYNTAX_STATE_MACHINE_H, COMMA, State_Transition_Characters, MAX_OPCODE, in a inconsistent manner. Name collision avoidance ...


2

Answers to your questions I learned C a long time ago from K&R “The C Programming Language” Version 1 (pre C89/C90). I started with K&R C's second revision, but that doesn't mean I didn't keep up with the changes over time. C99 brought many useful improvements that I happily use every day. Your code looks C99 as well, since you are using bool and //...


1

The tests are technically correct, but the value they have doesn't match the amount of time you spent on them. It looks like you're using class-based views, and in such case I'd expect LikeView and CategoryView in the routes should be called the same way as other views, ie. with .as_view(). If my assumption is correct, then your tests should at least catch ...


Only top voted, non community-wiki answers of a minimum length are eligible