Q's on my first python script
Scott David Daniels
Scott.Daniels at Acm.Org
Sun May 10 13:31:54 EDT 2009
Steven D'Aprano wrote:
> On Sun, 10 May 2009 12:52:21 +0000, kj wrote:
> ....
>> 5. The variable wd is meant to be "global" to the script. In other
>> languages I've programmed in I've seen some typographic convention
>> used for the name of such variables (e.g. all caps) to signal this
>> widened scope. Does python have such a convention?
>
> As a general rule, it's best to avoid globals variables as much as
> possible.
>
> One convention I occasionally use is to prefix global variables with a
> lowercase g. And then ruthlessly refactor my code until any variable
> starting with a lowercase g is removed :)
You (the OP) don't seem to know about PEP 8, which advises 4-space
indents, all-caps constants, and many more style specifics.
http://www.python.org/dev/peps/pep-0008/
--Scott David Daniels
Scott.Daniels at Acm.Org
More information about the Python-list
mailing list