Re: [docs] Incorrect statement in section 8.3 of Python Tutorial
Thanks for the response! I just retried it and also got the B B B that the doc says I should get. Which is probably a good reason to remind myself not to try to correct things when I'm a newbie. Except of course, who else reads tutorials, except newbies?
Unfortunately, my original work was all done in interactive mode, but after playing around a bit, I suspect I might have defined all my classes with Exception as the parm rather than the previous class. ie: class B(Exception): class C(Exception): class D(Exception): When I do that, I get the behavior I reported.
Sorry to have wasted your time.
I'm loving Python so far! Randy
Randy Duncan, PMP PMI-ACP CSM Test Architect, IBM Cloud Infrastructure Core Fabric Team 14001 Dallas Parkway, Suite M100, Dallas, TX 75240 214-873-8316 Office | 469-360-7232 Cell | firstname.lastname@example.org
From: Zachary Ware email@example.com To: docs firstname.lastname@example.org Cc: Randy Duncan email@example.com Date: 11/30/2017 02:02 PM Subject: Re: [docs] Incorrect statement in section 8.3 of Python Tutorial Sent by: firstname.lastname@example.org
On Mon, Nov 27, 2017 at 1:19 PM, Randy Duncan email@example.com wrote:
I believe I found an erroneous statement in the Python tutorials.
In section 8.3 found here (
There is a section showing how to handle exceptions which works as advertised:
However, the next line in the tutorial state this:
Note that if the except clauses were reversed (with except B first), it would have printed B, B, B — the first matching except clause is
I re-entered the example and reversed the except clauses, and got this result which does not match the statement:
Thanks for the report! However, I just tried it myself and got the output predicted by the docs. Can you show how you defined B, C, and D?
Regards, -- Zach