Why not a, b += i, j? (augmented assignment via tuple unpacking)
Michael Hudson
mwh at python.net
Wed Nov 27 05:35:55 EST 2002
Steven Rumbalski <srumbalski at prodigy.net> writes:
> In python I can write:
>
> a, b = i, j
>
> but the following is not legal:
>
> a, b += i, j
>
> Is there a reason that allowing this would be bad?
Well, as others have said it's not totally clear what it does (though
I thought it pretty obvious what you meant).
> Why does Python forbid this?
It would probably be a swine to implement, for one thing... I did the
grammar hacks for augmented assignment back in 2000 and allowing this
didn't even occur to me.
Cheers,
M.
--
: Giant screaming pieces of excrement, they are.
I have a feeling that some of the people in here have a
MUCH more exciting time relieving themselves than I do.
-- Mike Sphar & Dave Brown, asr
More information about the Python-list
mailing list