[Python-Dev] 'import as'

Barry A. Warsaw bwarsaw@beopen.com
Fri, 18 Aug 2000 09:27:05 -0400 (EDT)


>>>>> "Gordo" == Gordon McMillan <gmcm@hypernet.com> writes:

    Gordo> A whole lot rides on what you mean by "resulting" above. If
    Gordo> by "resulting" you mean "goom", then "import goom.bah as
    Gordo> snarf" would result in my namespace having "snarf" as an
    Gordo> alias for "goom", and I would use "bah" as "snarf.bah". In
    Gordo> which case Greg Ewing is right, and it's "import <dotted
    Gordo> name> as ..."  that should be outlawed, (since that's not
    Gordo> what anyone would expect).

Right.

    Gordo> OTOH, if by "resulting" you meant "bah", things are much 
    Gordo> worse, because it means you must patched code you didn't 
    Gordo> understand ;-b.

But I think it /is/ useful behavior for "import <dotted name> as" to
bind the rightmost attribute to the local name.  I agree though that
if that can't be done in a sane way, it has to raise an exception.
But that will frustrate users.

-Barry