Message123642
"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. |
|
Date |
User |
Action |
Args |
2010-12-08 20:24:37 | ocean-city | set | recipients:
+ ocean-city, belopolsky, brian.curtin |
2010-12-08 20:24:37 | ocean-city | set | messageid: <1291839877.54.0.391882397594.issue10654@psf.upfronthosting.co.za> |
2010-12-08 20:24:35 | ocean-city | link | issue10654 messages |
2010-12-08 20:24:35 | ocean-city | create | |
|