Modules aren't first-class values (was: New to Python: Features)

Andreas Kostyrka andreas at kostyrka.org
Tue Oct 5 17:42:37 EDT 2004


On Tue, Oct 05, 2004 at 08:08:03PM +0000, Cameron Laird wrote:
> I've seen you assert this a couple of times.  I haven't been
> able to spot the revelation in this thread which inspired you
> to it.  I suspect there's a confusion somewhere.  Modules
> are *not* first-class values, although their names are.  It
How did you come to this conclusion? I mean modules are first class
values ;)
>>> import types
>>> types.ModuleType("TEST")
<module 'TEST' (built-in)>
>>> x=types.ModuleType("TEST2")
>>> import sys
>>> y=sys.modules['os']
>>> x==y
False

Andreas
> sounds as though the standard documentation lacks something
> in regard to modules, but I don't know what it is.  If you
> present the idea in some detail, perhaps someone will come
> up with an idea on better documentation.
> -- 
> http://mail.python.org/mailman/listinfo/python-list



More information about the Python-list mailing list