New assignmens ...

Jon Ribbens jon+usenet at unequivocal.eu
Fri Oct 22 15:15:01 EDT 2021


On 2021-10-22, Stefan Ram <ram at zedat.fu-berlin.de> wrote:
> Paulo da Silva <p_d_a_s_i_l_v_a_ns at nonetnoaddress.pt> writes:
>>Why doesn't this work
>>	if (self.ctr:=self.ctr-1)<=0:
>>while this works
>>	if (ctr:=ctr-1)<=0:
>
>   assignment_expression ::=  [identifier ":="] expression,
>   but the attribute references "self.ctr" is no identifier!

This seems a surprising omission. You'd expect at least 'attributeref'
and 'subscription' to be allowed, if not the whole of 'target'.


More information about the Python-list mailing list