627
you are viewing a single comment's thread
view the rest of the comments
[-] uranibaba@lemmy.world 12 points 3 days ago

I would love to see the implementaion.

[-] edinbruh@feddit.it 18 points 2 days ago* (last edited 2 days ago)

The implementation is not very exciting, I capture a variable in python. It could have been done more cleanly.

1000041934

The proof is this. But, I could have made mistakes, it was many years ago.

1000041935

Note that in python you'll never be able to run is_even(5) the stack cannot handle it

Edit: daaaamn, that variable is ugly as hell. I would never do things like that now.

[-] squaresinger@lemmy.world 1 points 1 day ago

It never occurred to me that you could assign fields to a function. I mean, it totally makes sense considering that functions are objects in Python. It just never occurred to me that this is a thing one can do. Crazy.

[-] edinbruh@feddit.it 1 points 22 hours ago

Please don't do that, I was stupid when I wrote that. But still, in very dynamic languages like python or js everything is an object, including functions, so you can just do object stuff on them.

[-] squaresinger@lemmy.world 1 points 14 hours ago

I wasn't going to, and after I saw it it totally makes sense that it's possible, it just never occurred to me.

I guess this could be used like static variables inside functions in c. So scope-limited global variables. Not a good design choice in most cases.

load more comments (3 replies)
load more comments (3 replies)
this post was submitted on 13 Dec 2025
627 points (100.0% liked)

Programmer Humor

27882 readers
299 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS