Jess Austin <jess.aus...@gmail.com> added the comment:

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.

----------
nosy: +jess.austin

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue2706>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to