module not callable - why not?

Hung Jung Lu hungjunglu at yahoo.com
Mon Apr 19 19:35:39 EDT 2004


"Fredrik Lundh" <fredrik at pythonware.com> wrote in message news:<mailman.773.1082397637.20120.python-list at python.org>...
> Hung Jung Lu wrote:
> 
> > > That's not the only answer, and it's not the one I use:
> > >
> > >     import foo
> > >     getattr(foo, 'name')
> >
> > You can't do this when you are inside the module itself.
> 
> inside the module, it's spelled
> 
>     name
> 
> </F>

Can't believe I have to reply to all these silly bursts. :)

This is a frequently asked question, Fredrik. I don't make it up. Now,
think again why newbies and oldies alike at times need to access
variables by name strings. Next time, digest first before you post.
Don't disappoint me. :)

regards,

Hung Jung



More information about the Python-list mailing list