10 Jan 2011 02:11
Re: Module aliases and/or "real names"
On 01/09/2011 12:18 PM, Nick Coghlan wrote: > On Mon, Jan 10, 2011 at 3:56 AM, Ron Adam<rrr@...> wrote: >> On 01/09/2011 12:39 AM, Nick Coghlan wrote: >>>> Also consider having virtual modules, where objects in it may have come >>>> from >>>> different *other* locations. A virtual module would need a way to keep >>>> track >>>> of that. (I'm not sure this is a good idea.) >> >>> It's too late, code already does that. This is precisely the use case >>> I am trying to fix (objects like functools.partial that deliberately >>> lie in their __module__ attribute), so that this can be done *right* >>> (i.e. without having to choose which use cases to support and which >>> ones to break). >> >> Yes, __builtins__ is a virtual module. > > No, it's a real module, just like all the others. As George pointed out it's "builtins". But you knew what I was referring to.(Continue reading)I wasn't saying it's not a real module, but there are differences. Mainly builtins (and other c modules) don't have a file reference after it's imported like modules written in python. >>> import dis >>> dis <module 'dis' from '/usr/local/lib/python3.2/dis.py'>
I wasn't saying it's not a real module, but there are differences. Mainly
builtins (and other c modules) don't have a file reference after it's
imported like modules written in python.
>>> import dis
>>> dis
<module 'dis' from '/usr/local/lib/python3.2/dis.py'>
RSS Feed