> On 25 Nov 2021, at 13:06, ehmatt...@gmail.com wrote:
> 
> Hi everyone,
> 
> I've been really impressed by the recent improvements to error messages in 
> Python 3.10. The specific suggestions in some error messages are going to 
> save countless hours of people's time. The benefits for beginners are fairly 
> obvious. But even for experienced programmers, the difference between seeing 
> a missing colon in an error message and just adding it where it should have 
> been vs spending 30 seconds or a minute figuring out what's missing at the 
> start of a loop adds up.
> 
> 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. Here's the simplest example I can come up with:
> 
> name = 'eric'
> print(name)
> 
> name == 'ever'

The __eq__ method is run which might have side effects.
Which may mean raising error may be a backwards compat issue,
Maybe it is a problem for linters to report as a problem.
I have not checked if they already do.

> print(name)
> 
> We want to assign a new value to an existing variable, but we accidentally 
> type a second equals sign. The output here makes the mistake fairly obvious, 
> but in longer programs it can take a while to spot this issue.
> 
> I know there are some editors and linters that flag this. Is there any reason 
> not to raise a warning or even an error at the language level? Is there any 
> reason to use a bare logical comparison in real-world code?
> _______________________________________________
> 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/4QVUWND6FFDWCD3DL3BR3763EQRAAI5D/
> Code of Conduct: http://python.org/psf/codeofconduct/
> 

_______________________________________________
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/VTEHJONXDAV3SX2IOCIOM3Q43J3SRCQ7/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to