Augmented Assignment (was: Re: PEP scepticism)

Thomas Wouters thomas at xs4all.net
Fri Jul 6 17:52:28 EDT 2001


On Fri, Jul 06, 2001 at 11:48:18AM +0000, Guido van Rossum wrote:
> Thomas Wouters <thomas at xs4all.net> writes:
> > But then you could run into trouble on, say,

> >   () += y

> > because the empty tuple is shared, just like interned strings and integers.
> > The refcount *could* be 2, and you end up modifying someone else's empty
> > tuple.

> No, because "() += y" is syntactically illegal.

But
    x = ()
    x += y

is not, and that's exactly what I meant.

-- 
Thomas Wouters <thomas at xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!




More information about the Python-list mailing list