Return value of an assignment statement?

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Sat Feb 23 03:03:40 EST 2008


On Fri, 22 Feb 2008 11:00:17 -0800, Aahz wrote:

> It's just too convenient to be able to write
> 
> L += ['foo']
> 
> without rebinding L.

<nitpick>But ``+=`` does rebind.</nitpick>

Doesn't matter in this case but we've had confused programmers asking
questions here when `L` is a class attribute and it's rebound to the
instance, or if they tried it on a list in a tuple.  Extending a list
that's a read only property doesn't work either.

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list