Skip to content
Advertisement

What is the naming convention for Python class references

What is the naming convention for a variable referencing a class in Python?

JavaScript

Here is another example that resembles my situation:

JavaScript

I would prefer ReferenceToClass, that everybody new to the code knows it’s a class and not an instance. But as poplitea wrote, literature reference would be great.

Advertisement

Answer

On module level the second:

ReferenceToClass = MyClass

As a function argument, the first:

reference_to_class = MyClass

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement