Conversation

Alice Averlong🏳️‍⚧️

a true programmer can write bad C in any language

1
4
2

I know programmers who use exceptions and they're all cowards

2
0
0

Alice Averlong🏳️‍⚧️

Edited 16 days ago

I think this coder may have been trying to do manual memory management in python

they do, like:

def get_url(url):
response = request.get(url)
document = json.loads(response)
response=None # <-- this line
return document

like, that almost makes sense in C, right? they're freeing the HTTP response. but this is python, we have a reference-counting garbage collector

2
0
0

Don't call list.extend and pass a dict, kids

2
0
0

as someone who has been a python programmer since I was struck by the beauty of language when I first encountered it around 2006, this code is doing something with python, where...

It's like being a concert violinist and watching someone use a Stradivarius to hammer in a nail.

0
0
0

@foone Python handing back the keys when you pass it a dict is its way of being politely wrong. It does exactly what you said, never what you meant.

1
0
0

@elanabelle yep! it's the kind of error which is why I like to get code into a runnable state as soon as possible and iterate: some errors you just can't find until the rubber hits the road and shit is executing, because no type checker will tell you that what you wrote does what you wrote, not what you mean

0
0
0
@foone don't have goto in your language? use exceptions!
0
0
0