weird isinstance/issubclass behavior?
ian.g.kelly at gmail.com
Thu Nov 29 17:41:22 CET 2012
On Thu, Nov 29, 2012 at 9:07 AM, lars van gemerden <lars at rational-it.com>wrote:
> > PS: this is somewhat simpler than the actual case i've encountered, and
> i haven't tested this exact case, but for now i hope this is enough to get
> some of your insight.
> I know for sure that the imports both import the same file, though if i
> understand you correctly, it creates 2 different module objects? Are module
> object only created on an import statement?
Yes, Python sees imports of two different absolute module paths and does
not recognize them as being the same file, so it imports each separately.
This scenario typically arises when your sys.path includes a folder that is
actually a module itself. Recommended usage: don't do that. Your sys.path
entries should contain modules and packages, not point inside them.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list