Postfix/Prefix Operators (++,--)
peter at engcorp.com
Sat Jun 7 04:13:41 CEST 2003
Joshua Marshall wrote:
> List comprehensions let you rebind a variable in an expression, so
> there is some precedent for this:
> >>> c = 1
> >>> a = [c - 1 for c in [c + 1]]
> >>> a
> >>> c
> but I'm not fond of list comprehensions either.
I seem to recall several posts to the effect that this was an
unfortunate and/or unexpected and undesirable side-effect of
the implementation but that now that it's here, we're sort of
stuck with it since people believe code already depends on it.
Personally, I'd much prefer to see that usage deprecated ASAP
and eliminated in the near future, but I guess it's a wart
we can (and must?) live with.
More information about the Python-list