Kay Schluehr wrote:
if you manage to import the same thing multiple times, you'll have
multiple class objects representing the same source code, and is-
instance won't work properly.
Importing a class/module multiple times does not cause the problem.
Writing
import ForeignPackage.B
Fredrik Lundh wrote:
Kay Schluehr wrote:
if you manage to import the same thing multiple times, you'll
have
multiple class objects representing the same source code, and is-
instance won't work properly.
Importing a class/module multiple times does not cause the problem.
Writing
Hi people,
I wonder why the isinstance() function is sensitive about the import
path i.e. the result depends not only on the class and the instance but
also on how a class is imported?
Example:
MyPackage/ Top-level package
__init__.py Initialize package
Kay Schluehr wrote:
I wonder why the isinstance() function is sensitive about the import
path i.e. the result depends not only on the class and the instance but
also on how a class is imported?
isinstance uses class object identity.
if you manage to import the same thing multiple times,
Fredrik Lundh wrote:
Kay Schluehr wrote:
I wonder why the isinstance() function is sensitive about the
import
path i.e. the result depends not only on the class and the instance
but
also on how a class is imported?
isinstance uses class object identity.
if you manage to import the same