[Python-Dev] PEP 572: Assignment Expressions
Tim Peters
tim.peters at gmail.com
Tue Apr 17 23:57:15 EDT 2018
[Paul Moore]
>> the next question will likely be "so why does = exist at all?"
[Greg Ewing <greg.ewing at canterbury.ac.nz>]
> And if we decide to make ':=' the official assigment operator and
> deprectate '=', the next question will be "Why do we have '=='
> instead of '='?"
Which would be a fine question! In Python's very early days, it
didn't have "==" at all: plain "=" was used for both assignment and
equality testing.
>From the HISTORY file:
"""
New features in 0.9.6:
...
- '==' is now the only equality operator; "../demo/scripts/eqfix.py" is
a script that fixes old Python modules
"""
That script crawled a source tree and replaced instances of "=" used
for equality testing with the new-fangled "==". We can obviously do
something similar to replace instances of "=" used for assignment when
that's removed, and I'm sure nobody will complain about that either
;-)
More information about the Python-Dev
mailing list