Returning same type as self for arithmetic in subclasses

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


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

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
http://tinyurl.com/6m373
for instance.

                   Michele Simionato




More information about the Python-list mailing list