Marco Buttu added the comment:

Thanks Jim. I tested thise exec() in Py2.7 and Py3 (3.5 - 3.7):

exec("if True:\n" + " "*width + "1\n" + "\t2\n")

* width == 0 raises a IndentationError both in Py2 and Py3
* width in range(1, 8) raises an IndentationError in Py2 and TabError in Py3
* width == 8 is OK in Py2, and raises a TabError in Python 3
* width > 8 is the same as width == 0

I think the most important case, is when width==4 or width==8, because they are 
the usual widths of the TAB. In these cases, the editor will show a "correct" 
level of indentation, but Python will raise an exception and a beginner user 
will not understand the reason. IMO is here that Lib/tabnanny.py really comes 
in handy. And in these cases (width== 4 or 8), Python 3 raises a TabError, but 
if we write in the doc that it raises an IndentationError, IMO the user perhaps 
will think there is an error in the doc, because IMO on the average he/she will 
not spot that TabError is a subclass of IndentationError. Thats why I think it 
is better to not specity the exeption type.

Anyway, it is really a minor issue, and currently is also related to other 
issues, so there is no need to discuss to much for such a detail. Finally, the 
wording in the pull request is good enough for me :) Thanks

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29387>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to