How to make Python interpreter a little more strict?

Mark Lawrence breamoreboy at yahoo.co.uk
Sat Mar 26 06:55:09 EDT 2016


On 25/03/2016 12:06, Aleksander Alekseev wrote:
> Hello
>
> Recently I spend half an hour looking for a bug in code like this:
>
> eax at fujitsu:~/temp$ cat ./t.py
> #!/usr/bin/env python3
>
> for x in range(0,5):
>      if x % 2 == 0:
>          next
>      print(str(x))
>
> eax at fujitsu:~/temp$ ./t.py
> 0
> 1
> 2
> 3
> 4
>
> Is it possible to make python complain in this case? Or maybe solve
> such an issue somehow else?
>

How does the interpreter work out that you've typed 'next' instead of 
'continue'?

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence




More information about the Python-list mailing list