this post was submitted on 12 May 2024
519 points (97.1% liked)
Programmer Humor
32410 readers
1840 users here now
Post funny things about programming here! (Or just rant about your favourite programming language.)
Rules:
- Posts must be relevant to programming, programmers, or computer science.
- No NSFW content.
- Jokes must be in good taste. No hate speech, bigotry, etc.
founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Meme is funny, but that exception used as flow control hurts.
Tbf python guidelines encourage it over if/else in cases like this. "Easier to ask for forgiveness than for permission" or something along the lines
Day 598 of asking for a way to tell which functions throw exceptions in Python so I can know when to wrap in try catch. Seems to me that every other language has this, but when I've asked for at least a linter that can tell me I'm calling a function that throws, the general answer has been "why would you want that?"
How am I supposed to ask for forgiveness if it's impossible to know that I'm doing something risky in the first place?
cant practically anything throw an exception given the right (sometimes extremely remotely possible) circumstances?
Not really. Exceptions are a controlled way of indicating something went wrong in an application.
The only point where you wouldn't know about the possibility of one is when you don't know enough about the language features you're using or when you use a badly documented library or framework.
dont many of the language primitives confer the possibility of thrown exceptions?