Why x+=1 doesn't return x value instead of an object
Jon Ribbens
jon+usenet at unequivocal.eu
Fri Oct 30 23:37:10 EDT 2020
On 2020-10-31, Chris Angelico <rosuav at gmail.com> wrote:
> On Sat, Oct 31, 2020 at 1:51 PM Jon Ribbens via Python-list
><python-list at python.org> wrote:
>>
>> On 2020-10-31, Stefan Ram <ram at zedat.fu-berlin.de> wrote:
>> > Siddhharth Choudhary <siddharth654choudhary at gmail.com> writes:
>> >>I want to know why x+=1 does not return the value of the variable.
>> >
>> > Which value? The old or the new one?
>> >
>> > Expressions never return values.
>>
>> Except when they're assignment expressions, when they do.
>
> Expressions DO have values, but assignment is a statement, not an
> expression. (Assignment expressions don't have augmented forms, so
> there's no ambiguity.)
Sorry, could you say that again in English?
More information about the Python-list
mailing list