Augmented Assignment (was: Re: PEP scepticism)

David Bolen db3l at fitlinxx.com
Thu Jun 28 20:45:49 EDT 2001


Paul Prescod <paulp at ActiveState.com> writes:

> Bruce Sass wrote:
> > 
> > 
> > ...what was a wart becomes a feature.
> 
> That was a lot of effort to understand a typing shortcut. It's somewhat
> unpythonic to trade a long explanation for a bit less typing.

I think that if the operation is phrased from the start as an action
undertaken by the source object itself and that the source object's
mutability can affect behavior, that it's not too big of a hurdle.

After all, part of the reason to permit the mutable objects to behave
differently is that augmented assignment isn't just for less typing,
but it can enable far more efficient operations (e.g., array *= 2
rather than array = array * 2 not having to create new large objects).
I think that ability is worth a few extra phrases of description.

--
-- David
-- 
/-----------------------------------------------------------------------\
 \               David Bolen            \   E-mail: db3l at fitlinxx.com  /
  |             FitLinxx, Inc.            \  Phone: (203) 708-5192    |
 /  860 Canal Street, Stamford, CT  06902   \  Fax: (203) 316-5150     \
\-----------------------------------------------------------------------/



More information about the Python-list mailing list