[Python-Dev] Type/class differences (Re: Sets: elt in dict, lst.include)

Neil Schemenauer nas@arctrix.com
Tue, 6 Feb 2001 10:06:09 -0800


On Tue, Feb 06, 2001 at 03:57:12PM +0100, Thomas Wouters wrote:
> Why ? Couldn't IntType do with an __add__[*] method that does this ugly magic
> for you ? Same for __sub__, __int__ and so on.

You're right.  I'm pretty sure my modified interpreter would handle
"return self+1" just fine (I can't test it right now).  If you wanted to
override the __add__ method you would have to write "return
IntType.__add__(self, 1)".

  Neil