By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,550 Members | 1,161 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,550 IT Pros & Developers. It's quick & easy.

Bug in handling of single underscore identifiers?

P: n/a
Today I installed the 'mechanoid' package from sourceforge, but the
self-test failed. On looking into it, I noticed odd behaviour in the
handling of single underscore module names. Importing into the
current namespace with 'from' seems to work, but accessing members of
the imported module only works if the imported name is qualified by
the containing module name.

For example:
from mechanoid import _mechanoid_Common
from _mechanoid_Common import Common Traceback (most recent call last):
File "<stdin>", line 1, in ?
ImportError: No module named _mechanoid_Common from mechanoid._mechanoid_Common import Common **succeeds** _mechanoid_Common

<module 'mechanoid._mechanoid_Common' from

Is this a bug or a feature? The language reference section 2.3.2
'Reserved classes of identifiers' indicates that identifiers starting
with a single underscore are not imported by "from module import *".
However I can't find any indication that "from module import _name"
should work this way.


Jul 18 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.