Hirokazu Yamamoto <[email protected]> added the comment:
"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.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue10654>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com