this post was submitted on 12 May 2024
513 points (97.2% liked)

Programmer Humor

31251 readers
1834 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 4 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 77 points 1 month ago (28 children)

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

[–] [email protected] 38 points 1 month 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] 20 points 1 month 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] 1 points 1 month ago (1 children)

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

[–] [email protected] 5 points 1 month 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 1 month 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)