Spot the invalid syntax

Steven D'Aprano steve+comp.lang.python at pearwood.info
Thu Mar 8 23:18:45 EST 2018


On Fri, 09 Mar 2018 00:47:21 +0000, MRAB wrote:

> On 2018-03-08 23:57, Ben Finney wrote:

>> You mean the tool is not always looking for mistakes while you type?
[...]
>> Certainly it'd be good to always have a *perfect* overseer checking for
>> mistakes . Until that happy day, though, let's use the tools available
>> to improve our code before even attempting to run it.
>> 
> "... while one types"? I'm not so sure.
> 
> In the past I've used an IDE (not for Python) that, for example,
> underlined any identifiers that hadn't been defined, but found it
> annoying because it was indicating errors that were due to my not having
> finished writing yet!

Aye, I find that error-checking while you type is a PITA. I tried using 
the Spyder IDE for a week or so, it was just so painful to use I couldn't 
keep going.

I'm not the world's fastest typest, so the fact that Spyder couldn't keep 
up with me was a serious black mark against it. There was visible lag 
between me typing and the characters showing up in the editor: I could 
type something like "for x in" before the "f" would appear.

Errors were highlighted in (I think?) red, and by displaying an icon next 
to the offending line. So as I would type, the screen would be constantly 
updated, slowly:

# me trying to type "print(mylist)"

p

pr # highlight in red and show the error icon

pri # highlight in red and show the error icon

prin  # highlight in red and show the error icon

print  # remove the highlighting and icon

print(  # display an error icon for missing parenthesis

print()  # okay, I'll type the paren first to keep the checker silent

print(m)

print(my)  # highlight the my in red and show the error icon

[skip a few more keystrokes]
print(mylist)  # finally remove the error highlighting


And because of the lag, it took about 15-20 seconds for the screen to 
update what took me 4-6 seconds to type.

This experience was so painful and unpleasant that it has permanently 
turned me off Spyder. I'd rather use Windows 95 Notepad.

 
> Type, pause for thought, syntax error... yes, I know it's a syntax error
> at the moment, but I'm not finished!

Not even "pause for thought".

I can *maybe* see the sense in checking each physical line once it is 
completed, but that's it. Or at least don't check words for mispellings 
until you have completed the token and started a new token, like your 
spell checker probably does. (The spell checker in this editor doesn't 
check for spelling errors until I hit the spacebar or Enter key, or use 
punctuation.)


-- 
Steve




More information about the Python-list mailing list