How do you code in Python ???
Oleg Broytmann
phd at phd.pp.ru
Sat May 18 03:46:33 EDT 2002
On Fri, May 17, 2002 at 07:07:54PM -0400, Peter Hansen wrote:
> Byron Hammond wrote:
> >
> > > Another one is which are "standard" coding [styles] in Python ?
> >
> > 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
>
> Nooooo!! Not Hungarian notation! :-)
>
> (Code with the above style is generally less readable than code
> without. This is probably a religious matter, but I believe few
> coding standards would recommend the above naming conventions.)
No, it is not a religion issue. There are pure technical objection. For
example, if you have an integer variable, and call it nItems, and later you
change the var to be a list, will you change its name in all source files?
It is tiresome. But if you will not change its name, you'll have even worse
situation - name that shows wron type.
Hungarian notation is bad.
(Another sign of it is that M$ uses it :)
Oleg.
--
Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru
Programmers don't die, they just GOSUB without RETURN.
More information about the Python-list
mailing list