Re: Hard times with packages and instances

2005-05-06 Thread Fredrik Lundh
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

Re: Hard times with packages and instances

2005-05-06 Thread Kay Schluehr
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

Hard times with packages and instances

2005-05-05 Thread Kay Schluehr
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

Re: Hard times with packages and instances

2005-05-05 Thread Fredrik Lundh
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,

Re: Hard times with packages and instances

2005-05-05 Thread Kay Schluehr
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