RE: Globals or objects? (is: module as singleton)

2008-02-22 Thread Duncan Booth
"James Newton" <[EMAIL PROTECTED]> wrote: > Duncan Booth wrote: >> you can create additional module instances (by calling new.module) > > Hi Duncan, > > Could you provide a scenario where this would be useful (and the best > practice)? Not really as such cases are few and far between. Try grep

RE: Globals or objects? (is: module as singleton)

2008-02-21 Thread James Newton
Duncan Booth wrote: > you can create additional module instances (by calling new.module) Hi Duncan, Could you provide a scenario where this would be useful (and the best practice)? > What you get with a module is support for locating a specific module > and ensuring that you don't get duplicate

RE: Globals or objects? (is: module as singleton)

2008-02-21 Thread Duncan Booth
"James Newton" <[EMAIL PROTECTED]> wrote: > Perhaps my real question is about how to visualize a module: what makes > an imported module different from an instance? On one level: nothing. An imported module is an instance of the module type. Modules don't have to be associated with python code:

RE: Globals or objects? (is: module as singleton)

2008-02-21 Thread James Newton
Mel wrote: >> James Newton wrote: >> Could you give a bare-bones demonstration of [implementing a singleton >> by using a module]? > > I had a club-membership application that ran for several years. > Default pathnames, etc. for the particular year came from a module > called thisyear.py: > #