[Python.NET] Subclassing again

Michael Amrhein Michael.Amrhein at t-online.de
Fri Oct 31 17:21:04 EST 2003


Hi,
there seem to be some more issues with subclassing.
I just stumble over the following:

Python 2.3.2 (#49, Oct  2 2003, 20:02:00) [MSC v.1200 32 bit (Intel)] on 
win32
Type "help", "copyright", "credits" or "license" for more information.
 >>> import CLR
 >>> from CLR.System.Drawing import Point
 >>> class P(Point):
...     def __repr__(self):
...             return 'P(%s,%s)' % self.X, self.Y
...
 >>> p=P()
 >>> p
<CLR.P object at 0x008EDA30>
 >>> repr(p)
'<CLR.P object at 0x008EDA30>'

P.__repr__ not called ?!?

 >>> p.X
Traceback (most recent call last):
   File "<stdin>", line 1, in ?
TypeError: Das Objekt stimmt mit dem Zieltyp nicht überein.
(saying: The object does not match the target type.)

Point methods can't be invoked on P instance ?!?

Any ideas?

Michael




More information about the PythonDotNet mailing list