[Python-ideas] Module aliases and/or "real names"

Georg Brandl g.brandl at gmx.net
Sun Jan 9 20:30:24 CET 2011


Am 09.01.2011 19:18, schrieb Nick Coghlan:
> On Mon, Jan 10, 2011 at 3:56 AM, Ron Adam <rrr at ronadam.com> 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.

__builtin__ (2.x) / builtins (3.x) is; __builtins__ you (Ron) should just
forget about.

Georg





More information about the Python-ideas mailing list