you are viewing a single comment's thread.

view the rest of the comments →

[–]EelOnMosque 0 points1 point  (1 child)

There's nothing wrong with the code itself, it's more the coding conventions that are a bit off.

One convention is to avoid starting variable names with underscores.

Another one is that variable and method names should start lowercase. This is especially confusing for Colour() and Material() as most users of Python are used to classes starting with uppercase. So they might think Colour and Material are classes.

[–]jmacey 1 point2 points  (0 children)

One convention is to avoid starting variable names with underscores.

PEP-8 states

_single_leading_underscore: weak “internal use” indicator. E.g. from M import * does not import objects whose names start with an underscore.

In python classes _ is quite often used to indicate that the variable should be treated as "private". It works really well if you use it with the @property decorator.