Python Forum

Full Version: try/except blocks
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
(Oct-05-2019, 03:55 PM)newbieAuggie2019 Wrote: [ -> ]means to bring into attention again the error detected during execution, with my tailor-made message.
You can raise the same type of exception (ZeroDivisionError in this case) with custom message - that is what I do in the example or raise your own type of exception (if you define one). It's preferred/recommended to use built-in types of exception if they fit your needs
(Oct-05-2019, 04:42 PM)perfringo Wrote: [ -> ]I recommend to type help('try') and/or help('EXCEPTIONS') into Python interactive interpreter and enjoy wonderful world of built-in help (these topics are especially extensively covered). One can't be master of try..except unless he knows how to use else and finally as well.

Thanks a lot!

Unfortunately, I find it more geared to people with already some knowledge than to newbies.

I found very difficult to understand the simple 'to raise an exception' in layman's terms. It's like we are not speaking English anymore, as the meaning is completely different!!!

You have to keep in mind that I'm not only a newbie in Python, but that I also have no programming background; so some simple things, expressions, commands and the like, while they could be self-explanatory to the programmers' community, it's like an indecipherable new language to me!

Although I was completely taken aback by this:
[Image: squeezed-text-01.png]
it was not really that bad, when I opened it, although still an indecipherable message to me!

I thank you for pointing it out to me, as it could be great when I learn more.

All the best,

(Oct-05-2019, 05:37 PM)buran Wrote: [ -> ]
(Oct-05-2019, 03:55 PM)newbieAuggie2019 Wrote: [ -> ]means to bring into attention again the error detected during execution, with my tailor-made message.
You can raise the same type of exception (ZeroDivisionError in this case) with custom message - that is what I do in the example or raise your own type of exception (if you define one). It's preferred/recommended to use built-in types of exception if they fit your needs

Thanks again!

All the best,
Pages: 1 2