Assignment Versus Equality
Christopher Reimer
christopher_reimer at icloud.com
Sun Jun 26 14:53:19 EDT 2016
On 6/26/2016 8:41 AM, MRAB wrote:
> On 2016-06-26 11:48, BartC wrote:
>> On 26/06/2016 08:36, Lawrence D’Oliveiro wrote:
>>> One of Python’s few mistakes was that it copied the C convention of
>>> using “=” for assignment and “==” for equality comparison.
>>
>> One of C's many mistakes. Unfortunately C has been very influential.
>>
>> However, why couldn't Python have used "=" both for assignment, and for
>> equality? Since I understand assignment ops can't appear in expressions.
>>
> [snip]
>
> Python supports chained assignments. For example, "a = b = 0" assigns
> 0 to both a and b.
>
> I'm not sure how common it is, though. I virtually never use it myself.
How can you not use chained assignments? I thought Python was the art of
the clever one-liners. :)
Chris R.
More information about the Python-list
mailing list