On Thu, Nov 25, 2021 at 9:51 AM Barry <ba...@barrys-emacs.org> wrote:

> > One common error that I haven't seen discussed is bare logical
> comparisons. They're syntactically legal so they don't raise errors, but I
> have never seen a real-world use case for one.


nor have I. However, this strikes me as very much a problem for linters to
solve (and some do already). I just tried mine, and it doesn't.


> > name == 'ever'
>

I do get a undefined name error in the linter if I do this by itself, but,
of course not if name haad been previously defined.

However, even from a linter's perspective, I think this is not exactly
misuse of "==", b ut rather a amore general "expression not assigned to
anything" working.

Of course, as Barry pointed out, you might have an unassigned expression in
order to get a side effect.

But the reason I think it's a linter's job is that I don't think there is
any other case where Python tries to warn you about things that are not
illegal.

Yes, this is one example where it might make sense, but where do we draw
the line?

-CHB

-- 
Christopher Barker, PhD (Chris)

Python Language Consulting
  - Teaching
  - Scientific Software Development
  - Desktop GUI and Web Development
  - wxPython, numpy, scipy, Cython
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/X6B27W3ZFT3VQRWUKRBQUSUR3T2NZMOD/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to