This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ocean-city
Recipients belopolsky, brian.curtin, ocean-city
Date 2010-12-08.20:24:35
SpamBayes Score 4.7733564e-09
Marked as misclassified No
Message-id <1291839877.54.0.391882397594.issue10654@psf.upfronthosting.co.za>
In-reply-to
Content
"NotImplementedError" was printed. This happened
when subclass of date or subclass of datetime.
(plain classes and subclass of time didn't print this)

////////////////////////////////////
// Code

from _datetime import date, datetime

class SubclassDate(date):
    sub_var = 1

a = SubclassDate(2002, 3, 2)
for i in 1, 1.0:
    print(a+i)  # "NotImplemented"

class SubclassDateTime(datetime):
    sub_var = 1

a = SubclassDateTime(2002, 3, 2, 3, 5)
for i in 1, 1.0:
    print(a+i)  # "NotImplemented"
a-i # TypeError: unsupported operand type(s) for -: 'SubclassDateTime' and 'float'

////////////////////////////////////
// Result

E:\python-dev\py3k>c:\Python32\python.exe \x.py
NotImplemented
NotImplemented
NotImplemented
NotImplemented
Traceback (most recent call last):
  File "\x.py", line 17, in <module>
    a-i # TypeError
TypeError: unsupported operand type(s) for -: 'SubclassDateTime' and 'float'

////////////////////////////////////////

I hope this helps.
History
Date User Action Args
2010-12-08 20:24:37ocean-citysetrecipients: + ocean-city, belopolsky, brian.curtin
2010-12-08 20:24:37ocean-citysetmessageid: <1291839877.54.0.391882397594.issue10654@psf.upfronthosting.co.za>
2010-12-08 20:24:35ocean-citylinkissue10654 messages
2010-12-08 20:24:35ocean-citycreate