Re: [docs] Incorrect statement in section 8.3 of Python Tutorial

I believe I found an erroneous statement in the Python tutorials.
In section 8.3 found here ( https://urldefense.proofpoint.com/v2/url?u=https-3A__docs.python.org_3.6_tutorial_errors.html&d=DwIFaQ&c=jf_iaSHvJObTbx-siA1ZOg&r=2hm5iaCSjiprqr-rfYXI0dho47AI_LMBBYH2C7Y2ww8&m=E1Ov6eTjsgWbASY2-3OX8iE25webARUK3MdxuZHbwpM&s=b7pNqM3mcug6zVT9LYkMvM0-LbguVTuDWfaEMhVNHSU&e= )
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
Hi Zach, 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 | randy.duncan@ibm.com From: Zachary Ware <zachary.ware+pydocs@gmail.com> To: docs <docs@python.org> Cc: Randy Duncan <randy.duncan@ibm.com> Date: 11/30/2017 02:02 PM Subject: Re: [docs] Incorrect statement in section 8.3 of Python Tutorial Sent by: zachary.ware@gmail.com Hi Randy, On Mon, Nov 27, 2017 at 1:19 PM, Randy Duncan <randy.duncan@ibm.com> wrote: triggered.
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
participants (1)
-
Randy Duncan