First, when I ask about elements, I mean units of measure, such as inches, feet, pixels, cells. I do not mean data types such as int and float.
Wikipedia refers to this as a type of logical data , rather than a physical data type .
I would like to know what is the best way to use variables.
Here is what code can go through what I ask:
board_length=8
Note that these are integers (or floats, I don't care), but I changed the units. Ive also kept the variable name the same. I could establish a convention, and that is the purpose of this question. Without a guide, I could do something like this:
board_length=8 board_length_inches=8*12
I would find this a random way to do something. Or, I can establish an agreement:
Fboard_length=8 Iboard_length=8*12
Or other options that I equally dislike. How can variables be described in a descriptive way, but as close to PEP-08 as possible?
To be as clear as possible, variables can have different data types, but the units will be the same (inches will have the same name, regardless of whether it was saved as an integer or integer),
python naming-conventions pep8
Robert Lugg
source share