seems like a bug in isinstance()

dmitrey dmitrey15 at gmail.com
Fri May 6 05:24:23 EDT 2011


hi all,

suppose I've created a class Point in file .../openopt/kernel/Point.py

Consider the code in file .../somewhere/file1.py
from openopt.kernel.Point import Point
p = Point()

now let's pass p into a func from .../openopt/kernel/file2.py and
check
from Point import Point
isinstance(p, Point)

So, it returns False!

p is <Point.Point instance at 0x30801b8>, while Point is <class
openopt.kernel.Point.Point at 0x2048e20>

I have Python 2.7.1+ (r271:86832, Apr 11 2011, 18:13:53)
D.



More information about the Python-list mailing list