We support some of these but not all of them right now.  Currently these should 
work:

__add__, __sub__, __pow__, __mul__, __floordiv__, __div__, __truediv__, 
__mod__, __lshift__, __rshift__, __and__, __or__, __xor__, __lt__, __gt__, 
__le__, __ge__, __eq__, and __ne__ and all of the r and i versions where 
applicable.

We seem to be missing the other categories.  I've opened a bug for this and 
expect we can get these added for beta 5.


Do you want to help develop Dynamic languages on CLR? 
(http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F0-45DF-8B78-DC1B43134038)

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Eugene Rosenzweig
Sent: Thursday, March 09, 2006 7:37 PM
To: users@lists.ironpython.com
Subject: [IronPython] Special method names?

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.

_______________________________________________
users mailing list
users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
_______________________________________________
users mailing list
users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to