Python Global Constant

Ulrich Petri ulope at gmx.de
Wed Jul 9 08:51:02 EDT 2003


"Peter Hansen" <peter at engcorp.com> schrieb im Newsbeitrag
news:3F0BE68B.893EB7E5 at engcorp.com...
> Krisztian Kepes wrote:
>
> > *** module any ***
> > import dirs;
> > def CheckDir(Dir):
> >   if Dir=dirs.Const_Up: xxx
>
> This code should work fine, although you might want to follow
> the Python conventions for capitalization and formatting of
> your code, to make it more readable for others.  For example,
> variables and functions are generally mixed case, as in checkdir
> or dir, while constants are usually ALLCAPS as in CONST_UP.

No it wont. "if Dir = dirs.Const_Up:" is invalid syntax (Note the = instead
of ==)

Ciao Ulrich






More information about the Python-list mailing list