Returning same type as self for arithmetic in subclasses
steve at holdenweb.com
Sat Jan 8 14:02:23 EST 2005
Tim Peters wrote:
> [Max M]
>>I subclass datetime and timedelta
> Generally speaking, no. But I'm sure someone will torture you with a
> framework that purports to make it easy <wink>.
Clearly the easy way is to have the type declaration introspect on the
definitions of datetime and timedelta and then auto-create methods
wrapping the base types' methods in a "myxxx" conversion.
left-as-an-exercise-for-the-reader-ly y'rs - steve
Steve Holden http://www.holdenweb.com/
Python Web Programming http://pydish.holdenweb.com/
Holden Web LLC +1 703 861 4237 +1 800 494 3119
More information about the Python-list