Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
try/except blocks
#11
(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
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#12
(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,
newbieAuggie2019

"That's been one of my mantras - focus and simplicity. Simple can be harder than complex: You have to work hard to get your thinking clean to make it simple. But it's worth it in the end because once you get there, you can move mountains."
Steve Jobs
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  RSA Cipher with blocks Paragoon2 0 452 Nov-26-2023, 04:35 PM
Last Post: Paragoon2
  How to properly format rows and columns in excel data from parsed .txt blocks jh67 7 1,799 Dec-12-2022, 08:22 PM
Last Post: jh67
  Am I a retard - else and finally blocks in a try statement RubenF85 6 2,512 Jan-12-2021, 05:56 PM
Last Post: bowlofred
  How to tabulate correctly repeated blocks? Xiesxes 4 2,869 Mar-21-2020, 04:57 PM
Last Post: Xiesxes
  Understanding program blocks newbieAuggie2019 2 1,913 Oct-02-2019, 06:22 PM
Last Post: newbieAuggie2019
  The Empty List Blocks Recursion leoahum 6 5,242 Mar-05-2019, 06:55 PM
Last Post: leoahum

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020