[Python-Dev] 'import as' (original) (raw)
Thomas Wouters thomas@xs4all.net
Fri, 18 Aug 2000 09:07:43 +0200
- Previous message: [Python-Dev] 'import as'
- Next message: [Python-Dev] 'import as'
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Thu, Aug 17, 2000 at 10:07:04PM -0400, Gordon McMillan wrote:
Thomas Wouters wrote:
> The other issue is the change in semantics for 'from-import'.
Um, maybe I'm not seeing something, but isn't the effect of "import goom.bah as snarf" the same as "from goom import bah as snarf"?
I don't understand what you're saying here. 'import goom.bah' imports goom, then bah, and the resulting module in the local namespace is 'goom'. That's existing behaviour (which I find perplexing, but I've never ran into before ;) which has changed in a reliable way: the local name being stored, whatever it would have been in a normal import, is changed into the "as-name" by "as ".
If you're saying that 'import goom.bah.baz as b' won't do what people expect, I agree. (But neither does 'import goom.bah.baz', I think :-)
Both forms mean that we don't end up looking for (the aliased) bah in another namespace, (thus both forms fall prey to the circular import problem).
Maybe it's the early hour, but I really don't understand the problem here. Ofcourse we end up looking 'bah' in the other namespace, we have to import it. And I don't know what it has to do with circular import either ;P
Why not just disallow "from ... import ... as ..."?
That would kind of defeat the point of this change. I don't see any unexpected behaviour with 'from .. import .. as ..'; the object mentioned after 'import' and before 'as' is the object stored with the local name which follows 'as'. Why would we want to disallow that ?
-- Thomas Wouters <thomas@xs4all.net>
Hi! I'm a .signature virus! copy me into your .signature file to help me spread!
- Previous message: [Python-Dev] 'import as'
- Next message: [Python-Dev] 'import as'
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]