Coding standard: Prefixing variables to indicate datatype
A. Lloyd Flanagan
alloydflanagan at attbi.com
Thu Jan 16 16:12:36 CET 2003
"Thomas Weholt" <2002 at weholt.org> wrote in message news:<0BuV9.11459$CG6.203654 at news4.e.nsc.no>...
> In my day-job I use Delphi/Object Pascal. My firm has a coding-standard
> where we prefix all variables with a single character to indicate datatype;
> strings are prefixed with s, integers with i, floats with f etc. etc.
My opinion: If your use of a variable is so far away from its
declaration that you can't tell what type it is, your procedure is too
long. A naming standard can't make up for code that's not readable
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?
More information about the Python-list