[ python-Bugs-706253 ] python accepts illegal "import mod.sub as
name" syntax
SourceForge.net
noreply at sourceforge.net
Tue Mar 23 16:13:28 EST 2004
Bugs item #706253, was opened at 2003-03-19 04:44
Message generated for change (Comment added) made by bcannon
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=706253&group_id=5470
Category: Python Interpreter Core
>Group: None
Status: Closed
Resolution: Out of Date
Priority: 5
Submitted By: Alexander Miseler (amiseler)
Assigned to: Nobody/Anonymous (nobody)
Summary: python accepts illegal "import mod.sub as name" syntax
Initial Comment:
http://python.org/doc/current/ref/import.html
"To avoid confusion, you cannot import modules with
dotted names as a different local name. So import
module as m is legal, but import module.submod as s is
not."
sadly the interpreter accepts the illegal form without
comment which makes it "semi-legal".
packages that rely on this illegal form may cause
trouble with costum import implementations (i.e.
importing from zip file or similar)
tested with 2.2.2 and 2.3a2
----------------------------------------------------------------------
>Comment By: Brett Cannon (bcannon)
Date: 2004-03-23 13:13
Message:
Logged In: YES
user_id=357491
Fixed in 2.3 and 2.4 (but not in 2.2.3), so closing as out of date.
----------------------------------------------------------------------
Comment By: Brett Cannon (bcannon)
Date: 2004-03-23 13:13
Message:
Logged In: YES
user_id=357491
Fixed in 2.3 and 2.4 (but not in 2.2.3), so closing as out of date.
----------------------------------------------------------------------
Comment By: Brett Cannon (bcannon)
Date: 2003-06-08 15:19
Message:
Logged In: YES
user_id=357491
That line seems to have been removed from the 2.3
documentation as of revision 1.60 but it was not backported.
Need to find out from Martin v. Lowis whether there is a reason
he didn't backport it.
----------------------------------------------------------------------
Comment By: logistix (logistix)
Date: 2003-03-25 14:21
Message:
Logged In: YES
user_id=699438
Here's a case where I think the documentation should be
fixed instead of the bug. Every COM project I do starts
with 'import win32com.client as client'. I also don't see how
one syntax is any more confusing than the other. And even if
the above syntax was illegal, you could still do something like:
>>> import win32com.client
>>> server = win32com.client
If you really wanted to be confusing.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=706253&group_id=5470
More information about the Python-bugs-list
mailing list