Friday, October 6, 2023
Show HN: Use Python docstrings as exception messages https://ift.tt/7IslLz4
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/Sf7PUon October 6, 2023 at 11:39PM
Subscribe to:
Post Comments (Atom)
Show HN: Downr – An All-in-One Social Media Downloader for 50 Platforms https://ift.tt/rkmOVxK
Show HN: Downr – An All-in-One Social Media Downloader for 50 Platforms https://downr.org April 12, 2025 at 04:36PM
-
Show HN: High school robotics code/CAD/design binder release Hello HN! My name is Patrick, and I am a junior at my High School’s FRC robotic...
-
Show HN: D&D meets Siri – Interactive voice adventure Hey HN! I've been building tooling for voice-driven apps over the past few mon...
-
Show HN: I Made an AI Social Media Manager to Automate Content Creation Hey HN, I am a Solopreneur, and I love building apps to automate bor...
No comments:
Post a Comment