[IronPython] Special method names?

Eugene Rosenzweig eugene259 at internode.on.net
Fri Mar 10 04:36:51 CET 2006


I am relatively new to Python, I have been playing with a CPython and 
IronPython.
Does IronPython support special methods? For example:

 >>> class C:
...     v=0
...     def __init__(self,v):
...             self.v=v
...     def __int__(self):
...             return int(self.v)
...

 >>> c=C(33)
 >>> print int(c)
Traceback (most recent call last):
  File , line 0, in input##106
  File , line 0, in Make##121
TypeError: expected int, found instance

This doesn't present CPython with any problems and __int__() is in 
language reference manual, section 3.3.7

Eugene.




More information about the Ironpython-users mailing list