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: Free Website Style Guides https://ift.tt/exg4GlLShow HN: Free Website Style Guides Need help with the visual direction… Read More
Show HN: Cost&Time AI Estimator for MVP and Full Product. Seeking Your Feedback https://news.ycombinator.com/item?id=38208794Show HN: Cost&Time AI Estimator for MVP and Full Product. Seeking … Read More
Show HN: OP-A, a GPT that is a synthesizer https://ift.tt/k2JInhwShow HN: OP-A, a GPT that is a synthesizer Inspired by my Teenage Engi… Read More
Show HN: Docker Swarm Multi Tenant Proxy https://ift.tt/Ze3BHOSShow HN: Docker Swarm Multi Tenant Proxy You might know this issue wit… Read More
Show HN: Jwt.is – JSON Web Token Debugger https://ift.tt/LSeTgFGShow HN: Jwt.is – JSON Web Token Debugger The team at Rownd is excited… Read More
Show HN: Stories for Kids Using AI https://ift.tt/Nbe7KdyShow HN: Stories for Kids Using AI Every child deserves a tale that ig… Read More
Show HN: Smart Calories GPT https://ift.tt/JWLfxKVShow HN: Smart Calories GPT https://ift.tt/X67Uxpe November 11, 2023 a… Read More
Show HN: dbeel - A distributed thread-per-core db https://ift.tt/GWlP5XxShow HN: dbeel - A distributed thread-per-core db https://ift.tt/tivSm… Read More
0 Comments: