Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
if hashable
#4
(Sep-24-2023, 01:14 AM)Skaperen Wrote: for which this function needs to output a custom error message to explain what is wrong. so this function needs to do its own test of the value.
No, it does not need to do test of the value, use try/except instead to gracefully handle the error.
https://docs.python.org/3/glossary.html#term-EAFP
https://realpython.com/python-lbyl-vs-eafp/
Skaperen likes this post
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


Messages In This Thread
if hashable - by Skaperen - Sep-24-2023, 01:14 AM
RE: if hashable - by Gribouillis - Sep-24-2023, 09:02 AM
RE: if hashable - by Skaperen - Sep-24-2023, 05:26 PM
RE: if hashable - by buran - Sep-25-2023, 07:48 AM
RE: if hashable - by Skaperen - Sep-25-2023, 11:24 PM

Forum Jump:

User Panel Messages

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