[Python-Dev] Visual similarity of "=" and "==" (in context of PEP 572)

Mikhail V mikhailwas at gmail.com
Wed Apr 25 19:54:43 EDT 2018

Since the discussion about operator choice has completely migrated
here, I'll put my note also here.
>From the very beginning of PEP 572 discussion I have noticed
a strange fact - there is told a lot about visual similarity
of "=" and "==" in Python.
*Same is told in the PEP 572 (frequently asked question)
 as the reason for rejection of "=" as operator.*

I realize that currently there are other technical arguments against "=",
but I am the opinion that this very reason,
namely similarity of "=" and "==",  cannot be taken

I'll try to explain:
I have opened Notepad++ and  went to syntax highlighting
configurator. It took me 2 minutes to choose a syntax setup
that defines "==" (and other comparison operators if you wish)
as a token with custom style.
Now I can apply *custom color and size* to it and
this alone makes the operator very well seen and different from "=".

If that is not enough, I can set different *font* for the operator:
so I can basically turn "==" into anything I want.
With this in mind, I personally can't understand why you
complain about "=="?

Ok, you could say - not all editors can do this.
But even without that tweaks - I still don't find the
problem worth exaggeration.
It is not like I accidentally choose very similar names
for variables and then spend an hour trying to figure out
where is the bug comes from. With "==" it just takes some
attention to look at -if- statements and recheck if I
write "==" and not "=" where I need comparison.

I see it as as a "typo-magnet" but no way as a "bug-magnet" as it
was claimed repeatedly in the discussion.
A programmer already knows about this similarity and can
fix the typos easily.

The ":=" operator is of course slightly more different, but
still, only _slightly_ better in this regard.

With that said, I am not much interested in either
adding of the expression assignment, although I am
really worrying about the reasoning made about "="
and "==" in the discussion.

Hope you get my point here.
IMO either the PEP 572 should remove or at
least rephrase this point somehow or, even better,
concentrate on something more convincing in this regard.

Also I think Yury has made good point about the
introduction of ":=" -- it would co-exist with the "=".
So imo, if you get familiar with ":=", later on
it will just cause additional visual noise.
And I don't think a regular user will be much
interested in nuances of internal implementation
of new assignment - they'll just follow the logic
of the code and another operator will constantly
gain unnecessary attention at reading.


More information about the Python-Dev mailing list