Why prefer != over <> for Python 3.0?

Paul Rubin http
Sat Mar 29 07:08:16 EDT 2008


kwitters at telenet.be writes:
> I don't know if this is the right place to discuss the death of <> in
> Python 3.0, or if there have been any meaningful discussions posted
> before (hard to search google with '<>' keyword), but why would anyone
> prefer the comparison operator != over <>???

I doubt anyone cares.  Python probably chose != because it's what C uses.
The scary choice is /= which can be interpreted as an assignment.  Python
lacks assignment expressions partly because of a meme that using = instead
of == by accident is a common C bug.  I'm sure it happens but at least in
my own experience (from having written plenty of buggy C code over the
years) it's not that frequent.  Using /= instead of != seems more likely,
for programmers who switch between C and languages that use /= for nonequality.



More information about the Python-list mailing list