Returning same type as self for arithmetic in subclasses

michele.simionato at michele.simionato at
Sun Jan 9 00:42:36 EST 2005

Max. M.:
> So I wondered if there was a simlpler way to coerce the result into
> desired types rather than overwriting the __add__, __sub__ etc.

Tim Peters:
>> Generally speaking, no. But I'm sure someone will torture you with a
>> framework that purports to make it easy <wink>.

I will not dispute the Timbot assessment ;) He is also right that
people have
already undergone under this level of torture:  see
for instance.

                   Michele Simionato

More information about the Python-list mailing list