static variables inside a function

In C a static variable inside a function is only visible inside that function’s scope, but its lifetime is the entire life of the program, and it’s only initialized once. There is NO equivalence in Python. So if you want to be a proper python programmer you should just accept that! Use a class, use […]

Read More

typedef enum in Python

In C you might do this to create an automatically numbered from 0 list of values for example: In python you can do the same it with the Enum class Using Enum values

Read More

Global

Variables and objects created outside of a function are global and can be read (not written) by any function The global keyword can be used to create a global object inside a function. The global keyword must be used inside a function if it wants to change the value of a global object inside the […]

Read More

Naming conventions in Python

Whilst you can do what you want, the creators of Python specify naming conventions that should be followed: ClassNamesInStudlyCaps CONSTANTS_IN_ALL_CAPS variable_names_in_snake_case method_names_in_snake_case function_names_in_snake_case

Read More