Is this a bug?

Aahz aahz at pythoncraft.com
Thu Apr 28 16:18:40 EDT 2005


In article <mailman.2402.1114358128.1799.python-list at python.org>,
Fredrik Lundh <fredrik at pythonware.com> wrote:
>
>mapping += to extend is a design mistake (I guess someone got a
>little carried away).

There were two use cases that drove augmented assignment (I know you know
this -- but other people probably do not):

reallylongvariablename = reallylongvariablename + 1
hugearray = hugearray + tinyarray

The latter was particularly coming from the Numeric types.  The docs
probably should clarify that augmented assignment is *NOT* necessarily
the same as ``foo = foo + bar`` when ``foo`` is a mutable type.  You can
argue that you disagree with mapping ``+=`` to ``extend()``, but I don't
think it's fair for you to flatly claim that it's a design mistake.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"It's 106 miles to Chicago.  We have a full tank of gas, a half-pack of
cigarettes, it's dark, and we're wearing sunglasses."  "Hit it."



More information about the Python-list mailing list