This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author marco.buttu
Recipients JDLH, docs@python, marco.buttu, martin.panter, paul.moore, steve.dower, terry.reedy, tim.golden, xiang.zhang, zach.ware
Date 2017-02-10.10:27:00
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1486722420.97.0.348314244004.issue29387@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2017-02-10 10:27:01marco.buttusetrecipients: + marco.buttu, terry.reedy, paul.moore, tim.golden, docs@python, martin.panter, zach.ware, steve.dower, xiang.zhang, JDLH
2017-02-10 10:27:00marco.buttusetmessageid: <1486722420.97.0.348314244004.issue29387@psf.upfronthosting.co.za>
2017-02-10 10:27:00marco.buttulinkissue29387 messages
2017-02-10 10:27:00marco.buttucreate