This is probably shallow. Assigned to Guido in case it's very shallow : >>> from datetime import * >>> class C(date): ... def whatever(self): ... return "oops" >>> c = C(2002, 1, 1) >>> c.whatever() Traceback (most recent call last): File "", line 1, in ? AttributeError: 'datetime.date' object has no attribute 'whatever' >>> type(c) <type 'datetime.date'> >>> Was reported on c.l.py.
Logged In: YES user_id=6380 Here's a strawman fix. It makes 'date' a properly subclassable type, and makes all the other types (except tzinfo) non-subclassable.
Logged In: YES user_id=31435 I think the date enhancement is fine -- check it in! I'd leave off removing the basetype flag on the other types, though -- I expect we'll need to make them subclassable too.
Logged In: YES user_id=31435 I checked in changes (for 2.3b2) so that time, datetime, and timedelta are properly subclassable from Python too. That's all of 'em, so closing this now.