Is it just Syntactic Sugar ?
Moshe Zadka
moshez at math.huji.ac.il
Sat Jun 3 01:25:57 EDT 2000
On Wed, 31 May 2000, Guido van Rossum wrote:
> User classes can do whatever their author likes.
>
> A base class can be provided that defines __add_ab__, __sub_ab__ etc.
> in terms of self.__add__, self.__sub__, etc.
This is the only problem I have with this suggestion: I think the
implementation of the ADD_AB opcode should use the __add__ interface if
__add_ab__ isn't available.
IOW,
x += y is equivalent to x = x.__add_ab__(y) if x has __add_ab__, otherwise
to x = x+y
--
Moshe Zadka <moshez at math.huji.ac.il>
http://www.oreilly.com/news/prescod_0300.html
http://www.linux.org.il -- we put the penguin in .com
More information about the Python-list
mailing list