Show HN: Use Python docstrings as exception messages The following exception @dataclass class PodBayDoorsStillClosed(DocumentedError): """ I’m sorry, {self.user_name}. I’m afraid I can’t do that. """ user_name: str when raised as raise PodBayDoorsStillClosed('Dave') will print PodBayDoorsStillClosed: I’m sorry, Dave. I’m afraid I can’t do that. Reduce the boilerplate, use more exception classes to better express the business logic, or invent your own use cases :) Can be tried out as: pip install documented which works for Python ⩾ 3.8.1. https://ift.tt/8J2SBrE October 6, 2023 at 11:39PM
Show HN: Use Python docstrings as exception messages https://ift.tt/SD76J1u
Related Articles
Show HN: Vanity Git commit hash generator https://ift.tt/P2rix4eShow HN: Vanity Git commit hash generator Hi HN! This is just a fun li… Read More
Show HN: Merge – Connect Google Wear OS to Apple iOS https://ift.tt/yhkHqWBShow HN: Merge – Connect Google Wear OS to Apple iOS TLDR: Wear OS app… Read More
Show HN: Squabblr – A Twitter/Reddit hybrid platform https://ift.tt/JWEyXmKShow HN: Squabblr – A Twitter/Reddit hybrid platform Hey guys, I made … Read More
Show HN: Travel search engine calculating results in single digit ms https://ift.tt/D8eLF6cShow HN: Travel search engine calculating results in single digit ms h… Read More
Show HN: NumberTabs, A Notes App for your calculations https://ift.tt/SHo1AKEShow HN: NumberTabs, A Notes App for your calculations A Notes App for… Read More
Show HN: Yet Another Notepad App for macOS https://ift.tt/J9wo6kBShow HN: Yet Another Notepad App for macOS Any suggestion is welcomed … Read More
Show HN: Automating Job Search with AI https://ift.tt/N2ZHmGUShow HN: Automating Job Search with AI This is a personal experiment t… Read More
Show HN: Vercel-like preview deployment comments but for every platform https://ift.tt/DqQ15J0Show HN: Vercel-like preview deployment comments but for every platfor… Read More
0 Comments: