Message265334
| Author |
eltoder |
| Recipients |
Arfrever, barry, bru, eli.bendersky, eltoder, ethan.furman, facundobatista, iyogeshjoshi, juggernaut, mark.dickinson, pitrou, rhettinger, serhiy.storchaka, skrah, vstinner |
| Date |
2016年05月11日.18:53:27 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1462992807.78.0.0857920263338.issue23640@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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' |
|
History
|
|---|
| 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 |
|