variable naming...

Jeff Epler jepler at inetnebr.com
Sat Apr 28 16:32:31 EDT 2001


On Thu, 26 Apr 2001 16:34:41 GMT, Owen F. Ransen
 <ransen_spam_me_not at nemo.it> wrote:
> In C I am used to using the notation where the first bit
> of the name tells you the type of the variable:
> 
> int iNumFlames ;  // integer
> char szFlame[MAX_CHARS] ; // zero terminated string
>
I use the empty prefix ("") for all Python types which will hold
a value which is a Python object of some sort.  I use the same prefix 
to indicate a function which returns a Python object of some sort.

Thus, in:
	def fact(n):
		if n==0: return 1
		return n*fact(n-1)
you can know just by reading that 'n' holds a reference to a Python object,
and 'fact' will return a reference to a Python object.

Some people say Hungarian notation is bad, but I don't believe it.

Jeff



More information about the Python-list mailing list