Message265334
There's a similar issue with replace() methods on date/time/datetime classes. They create instances of derived types without calling derived __new__/__init__, thus potentially leaving those uninitialized.
>>> from datetime import date
>>> class D(date):
... def __init__(self, y, m, d):
... self.y = y
>>> D(2016,1,1).y
2016
>>> D(2016,1,1).replace(2015).y
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'D' object has no attribute 'y' |
|
Date |
User |
Action |
Args |
2016-05-11 18:53:27 | eltoder | set | recipients:
+ eltoder, barry, rhettinger, facundobatista, mark.dickinson, pitrou, vstinner, Arfrever, eli.bendersky, skrah, ethan.furman, serhiy.storchaka, bru, juggernaut, iyogeshjoshi |
2016-05-11 18:53:27 | eltoder | set | messageid: <1462992807.78.0.0857920263338.issue23640@psf.upfronthosting.co.za> |
2016-05-11 18:53:27 | eltoder | link | issue23640 messages |
2016-05-11 18:53:27 | eltoder | create | |
|