module naming?

Michal Wallace (sabren) sabren at manifestation.com
Tue Apr 18 23:39:12 EDT 2000


On Wed, 19 Apr 2000, Joal Heagney wrote:

 
> I'm new to the pythoning game, but is there a way to check to see if a file
> is loaded. I seem to remember that the from statement doesn't support that,
> but maybe you could make a call to a function that does a check on if the
> class already exists in program space, and if it doesn't imports it using
> the from ... import statement?

here's what I wound up doing (in weblib/__init__.py)

#################

def Request():
    import Request, weblib
    weblib.Request = Request.Request
    return Request.Request()

##################

So, the first time I call it I'm really calling a function that calls
a constructor and returns the new object.. and the second time, I call
the constructor directly.

Cheers,

- Michal
-------------------------------------------------------------------------
http://www.manifestation.com/         http://www.linkwatcher.com/metalog/
-------------------------------------------------------------------------





More information about the Python-list mailing list