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:

founded 5 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 78 points 6 months ago (28 children)

Meme is funny, but that exception used as flow control hurts.

[–] [email protected] 39 points 6 months ago (21 children)

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

[–] [email protected] 21 points 6 months ago (14 children)

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?

[–] [email protected] 2 points 6 months ago (1 children)

cant practically anything throw an exception given the right (sometimes extremely remotely possible) circumstances?

[–] [email protected] 5 points 6 months ago (1 children)

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.

[–] [email protected] 2 points 5 months ago

dont many of the language primitives confer the possibility of thrown exceptions?

load more comments (12 replies)
load more comments (18 replies)
load more comments (24 replies)