reloading modules and isinstance()

Tlis tlis01 at googlemail.com
Tue Dec 4 09:00:20 EST 2007


I am using a software system with an embedded Python interpreter
(version 2.3) for scripting. The KcsPoint2D.py module contains a
Point2D class with the following method:

def SetFromMidpoint(self, p1, p2):
   if not isinstance(p1, Point2D) or not isinstance(p2, Point2D):
      raise TypeError, 'some error message'
   ---

The problem is that after I launch my script once, and then use the
'Reload modules' button (presumably it calls reload() on all loaded
modules), the isinstance() tests shown above fails, even though the
expressions:

type(self)
type(p1)
type(p2)

all show: class 'KcsPoint2D.Point2D'

Could you explain, please what is going on? Why the isinstance()
function returns False?



More information about the Python-list mailing list