The interesting thing is how chained assignment is implemented.  In C, the
following is an expression, and has a value:

   a = b

This leads to the compiler not being helpful for the famous =/== typo in
this like:

  if (a = b)  { ... }

In python the only expression in:

  a = b = c

only has one expression: c

The rest is syntax for the assignment statement, where trailing =
identifies each of the targets to which the value of c is to be assigned.

An assignment statement begins with a series of one or more target
specifiers and ends with a single expression.

(Targets can be more complex, e.g.; x, y = p = 0, 0)

On Wed, Feb 17, 2016 at 7:28 PM, Nikolas Stevenson-Molnar <
[email protected]> wrote:

> The term is "chained assignment" (applied to other languages as well).
>
>
> https://en.wikipedia.org/wiki/Assignment_(computer_science)#Chained_assignment
>
> _Nik
>
> On Tuesday, February 16, 2016 at 12:06:10 PM UTC-8, anotherdjangonewby
> wrote:
>>
>> Hi,
>>
>> this may be a bit off-topic, but:
>>
>> How are expressions like:
>>
>> var1 = var2 = var3
>>
>> called Python. Without a hint I cannot goolge this.
>>
>> Thanks
>>
>> Kai
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/8c0392e7-a040-4d53-8e40-96aed5a41176%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/8c0392e7-a040-4d53-8e40-96aed5a41176%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAB%2BAj0trrGXS3xoxWzqDy49BAaXkz0E7bm_5TCvyvw1-mAAe4Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to