Python dot-equals (syntax proposal)

Alf P. Steinbach alfps at start.no
Sun May 2 01:05:26 EDT 2010


On 02.05.2010 06:06, * Aahz:
> In article<4bdcd631$0$27782$c3e8da3 at news.astraweb.com>,
> Steven D'Aprano<steve at REMOVE-THIS-cybersource.com.au>  wrote:
>> On Sat, 01 May 2010 07:13:42 -0500, Tim Chase wrote:
>>>
>>> The += family of operators really do rebind the symbol, not modify the
>>> object.
>>
>> They potentially do both, depending on the object, even for built-ins.
>
> No, they always rebind; sometimes they modify the object

If they always rebind and sometimes modify object then they "potentially do 
both", and so the "No" at the start of the sentence contradicts this later part.


> and sometimes
> they rebind the original target to the same object.

At the Python level that seems to be an undetectable null-operation. Granted one 
could see something going on in a machine code or byte code debugger. But making 
that distinction (doing nothing versus self-assignment) at the Python level 
seems, to me, to be meaningless.


Cheers,

- Alf



More information about the Python-list mailing list