this post was submitted on 12 Jun 2023
67 points (98.6% liked)

Programmer Humor

40805 readers
331 users here now

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

Rules:

founded 6 years ago
MODERATORS
 
top 9 comments
sorted by: hot top controversial new old
[–] abclop99@beehaw.org 1 points 2 years ago
a = a ^ b
b = a ^ b
a = a ^ b
[–] jnovinger@programming.dev 1 points 2 years ago

I raise you

@lambda _: _()
def result() -> int:
    global a; global b; a, b = b, a

hat tip to @sisyphean@programming.dev via Cursed Python

[–] MyNameIsRichard@lemmy.ml 0 points 2 years ago

Using an organic processor

[–] pec@sh.itjust.works 0 points 2 years ago (1 children)

Storing the value in the user instead of RAM!

[–] softhat@lemmy.world 0 points 2 years ago

This actually raises a very good question - could you increase the amount of available RAM by using the user?

Juggling chainsaws comes to mind.

[–] Crackhappy@lemmy.world 0 points 2 years ago

Never used Python but that's hilarious.

[–] bauklotz@feddit.de 0 points 2 years ago (1 children)
[–] 1stTime4MeInMCU@mander.xyz 0 points 2 years ago

That's like the canonical "swap two pointers" trick

[–] pewpew@feddit.it 0 points 2 years ago

So you are asking the user to do it