Coding standard: Prefixing variables to indicate datatype

Peter Hansen peter at engcorp.com
Thu Jan 16 16:49:22 CET 2003


"A. Lloyd Flanagan" wrote:
> 
> I do make an exception for the names of fields in a database table.
> The name of a field is referenced a long way from its definition
> (which is in the database), and database fields are very
> type-specific.  One could make similar arguments for global variables,
> but of course we don't use those, right?

That's correct, we don't, but even when we do we also make use of a 
naming convention to indicate that they *are* globals and that extra
special care must be taken when using them, as in "gRegisterItems" or
"global_Logger" and such.  ;-)

(A. Lloyd, I like your idea of using "distance from declaration"
as a guide for deciding when such a naming convention actually 
does become necessary, and the advice that in most cases if you
found such a convention to be necessary, you've already got bad code.)

-Peter




More information about the Python-list mailing list