Message84131
| Author |
jess.austin |
| Recipients |
amaury.forgeotdarc, belopolsky, fredrikj, jess.austin, jribbens, mark.dickinson, tleeuwenburg@gmail.com, vstinner, webograph |
| Date |
2009年03月25日.00:04:23 |
| SpamBayes Score |
2.5202063e-14 |
| Marked as misclassified |
No |
| Message-id |
<1237939464.57.0.053130167769.issue2706@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
A comment on the two most recent patches... For both of these, we can
do the following:
>>> from datetime import timedelta
>>> td = timedelta(12)
>>> td
datetime.timedelta(12)
>>> td //= 3
>>> td
datetime.timedelta(4)
>>> td //= timedelta(2)
>>> td
2 # CHANGED VARIABLE TYPE!
I think the last operation will trap unsuspecting programmers, and
provide no benefit for the savvy. There really is no reason to allow an
in-place operation like this to change the type of the variable so
drastically. (That is, I realize a similar thing could happen with ints
and floats, but it seems worse with timedeltas and ints.) I feel the
last operation should raise a TypeError, even though it would be quite
valid for a non-in-place operation. |
|