[Python-Dev] PEP 395: Module Aliasing

Nick Coghlan ncoghlan at gmail.com
Sun Mar 6 06:04:32 CET 2011


On Sun, Mar 6, 2011 at 2:54 PM, Ron Adam <rrr at ronadam.com> wrote:
>
>    ... if the key matches sys.modules.__missing__
>
> Works for me. ;-)
>
> We can find a better name than __missing__ later.  (minor detail)

__missing__ is a dict method. I was merely noting it would make more
sense to override that rather than __setitem__ to avoid slowing down
normal lookups in sys.modules.

However, I'll still advocate the simple approach (two entries) for
now. Assuming uniqueness of values in a dictionary is invalid in
general, so code assuming it for sys.modules is arguably already
incorrect. Definitely a point deserving of more discussion in the PEP,
though.

Cheers,
Nick.


-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-Dev mailing list