this post was submitted on 07 Dec 2023
957 points (100.0% liked)

196

16459 readers
1776 users here now

Be sure to follow the rule before you head out.

Rule: You must post before you leave.

^other^ ^rules^

founded 1 year ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] grue@lemmy.world 16 points 11 months ago (1 children)

That guy was shitty at Python, then. Python is all about EAFP instead of LBYL.

[–] lostme@lemmy.world 19 points 11 months ago (1 children)

Eat ass fast paced instead of lay back your lettuce?

[–] grue@lemmy.world 15 points 11 months ago

"Easier to Ask Forgiveness than Permission" vs. "Look Before You Leap."

In other words, in Python you should just write the code to do the thing and then put an exception handler at the bottom instead of cluttering up your function with guard code everywhere.