I thought I'd 'got' globals but...
meridian
stephen.dover at onetel.co.uk
Thu Jul 6 08:59:43 EDT 2006
Bruno Desthuilliers wrote:
> meridian wrote:
> > Bruno Desthuilliers wrote:
> >
> >>def doIt(name=None):
> >> global gname
> >> if name is None:
> >> name = gname
> >> else:
> >> gname = name
> >>
> >
> >
> > Thanks Bruno, works a treat...
> >
> But still very probably a bad idea.
>
Ok, my curiosity is pique'd - is there a better way to hold my
app/module globals?
I must say I'd prefer not to write global <var> in every function, for
every global var I need.
Maybe there's a simpler way to structure?... by a global class or
something?
Cheers
Steve
More information about the Python-list
mailing list