2001 Enchancement Wishlist
Thomas Wouters
thomas at xs4all.net
Wed Jan 10 13:37:34 EST 2001
On Tue, Jan 09, 2001 at 01:18:58PM +0000, Remco Gerlich wrote:
> Thomas Wouters <thomas at xs4all.net> wrote in comp.lang.python:
> > On Sat, Jan 06, 2001 at 07:51:35PM +0100, Alex Martelli wrote:
> > > "Andrew Dalke" <dalke at acm.org> wrote in message
> > > news:937l3u$gbi$1 at slb2.atl.mindspring.net...
> > > [snip]
> > > > proxy = Proxy(...)
> > > > sys.modules[module_name] = proxy
> > > >
> > > > In other words, what you import doesn't need to be a module.
> > > > It can be a class instance instead - or any other data type.
> > >
> > > Now THAT is interesting! I would never have guessed that the
> > > items in sys.modules need not be module objects. Is this
> > > documented, something I can rely on forevermore and just
> > > happened not to notice in my study, or just an accident of the
> > > current implementation which might go away anytime?
> >
> > Without pretending to channel Guido or someone similar important in that
> > area of Python, I think I can safely say it's to be considered an
> > implementation detail, and that the behaviour is undefined. It could even
> > be considered a bug, since 'import' claims to import a module into the
> > local namespace, and a class instance isn't a module :)
>
> And note that you can't use 'from proxy import *' when proxy is a class,
> it gives a type error.
Well, there is hope! For both you and Alex, and everyone else who thinks
Python should be even more consistent :-)
http://mail.python.org/pipermail/python-dev/2001-January/011494.html
Cross-fertilizing-ly y'rs,
--
Thomas Wouters <thomas at xs4all.net>
Hi! I'm a .signature virus! copy me into your .signature file to help me spread!
More information about the Python-list
mailing list