How do you code in Python ???

Byron Hammond byronh at bigpond.net.au
Fri May 17 09:56:14 EDT 2002


> Another one is which are "standard" coding in Python ?
>
> (thing like initCap, postfix private atribute with "_" and so on)

I've been wondering about this myself.
If you come up with anything else, please let me know...


Check this out for python coding style
http://www.python.org/peps/pep-0008.html

There are other coding styles listed as well.
Depends on your needs however...
Will other people need to read your code and make sense of it easily or do
you need something to cater more specifically for your needs?

I'm sure that including type information in the name of a variable could
be a good idea if it was important to know the type. eg:
nItemsSoFar = number of items so far (integer)
sID = identification (string)
cCar_Fast = instance of the car class. This is a fast one

Including scope information shouldn't be important I imagine (namespaces).

Can't think of anything else atm...

Byron





More information about the Python-list mailing list