Perhaps I am just dumb

Delaney, Timothy tdelaney at avaya.com
Mon Feb 11 18:26:08 EST 2002


> From: Steve Holden [mailto:sholden at holdenweb.com]
> "wooks" <wookiz at hotmail.com> wrote in message
> news:8852d33c.0202110117.374f062 at posting.google.com...
> [Quinn explains polymorphism]
> > ... if I get magic methods right, they are special functions which
> > if present enable the object to apply a unique interpretation of a
> > python operator.
> > So + has standard behaviour but will  adopt whatever is specified in
> > the __add__ function if one is present for the class.
> >
> > Yes?
> 
> Correct

However, also remember that there are *3* add methods ...

__add__
__radd__
__iadd__

I'll leave it up to the documentation to explain the difference :)

Tim Delaney




More information about the Python-list mailing list