global variables

M.E.Farmer mefjr75 at hotmail.com
Wed Feb 2 19:42:30 EST 2005


Steve,
Yes I agree ;) Never use builtin names.
I know better but missed it somehow.
I apologize for any confusion I may have caused.
Thank you Steve for the correction.
M.E.Farmer

Steven Bethard wrote:
> M.E.Farmer wrote:
> > alex wrote:
> >> is it possible to create 'global' variables that can be seen in
all
> >> other classes?
> >
> > What about using a class?
> >
> > Py> class globalVar:
> > ...    pass
> >
> > Py> globals = globalVar()
>
> Probably naming it something other than 'globals' would be a good
idea
> -- otherwise you'll hide the builtin globals() function.
>
> But I agree that the attributes of a class instance (as you suggest)
or
> the attributes of a module (as Steve Holden suggests) is probably the
> right way to go.
> 
> Steve




More information about the Python-list mailing list