r/ProgrammerHumor 1d ago

Meme purePythonMagic

117 Upvotes

22 comments sorted by

112

u/ctallc 1d ago

Looks like the new CS students just started school again…

18

u/Confident-Ad5665 1d ago

Is it September already?

0

u/Bomaruto 13h ago

Better than another lazy vibe coding "joke"

32

u/aberroco 1d ago

"Also, your computer is now magically making money for me"

2

u/mezantrop 1d ago

Not that I tried this myself, but, how to enable windows firewall back again?

14

u/SnooDoggos5474 1d ago

Clicking to execute a python file 🀒

1

u/goose_with_adhd 13h ago

The joke would be less good of it was opened by terminal

3

u/Cherepahe1 1d ago

Magic.

2

u/sadongrohiik 21h ago

Is this homoiconicity?

1

u/mezantrop 21h ago

Not really. It's just self-modifying code. But I like where you're going with this.

-4

u/QuestionableEthics42 1d ago edited 1d ago

"Magic"

file went from 320 bytes to 230, so impressive (massive /s). That is just sad, should be easily achievable in under 50 bytes. Not even trying.

Edit: I may have vastly overestimated how far 50 bytes goes in python, doing it 90 is actually pretty good

8

u/mikaleowiii 21h ago

You mean KB ? (which therefore isn't very impressive)

-1

u/QuestionableEthics42 21h ago

No, but 50 bytes prob isn't actually possible in python, I overestimated how much 50 bytes is. Can be done in 90 without compressing the payload though.

4

u/mikaleowiii 21h ago

I meant OP's file sizes

0

u/QuestionableEthics42 21h ago

Omg I'm blind haha. That makes more sense now. I missed that is was actually kb, wow

0

u/mezantrop 1d ago

Show me your kung fu 😏

0

u/QuestionableEthics42 21h ago

Best I managed was 90 bytes without compression πŸ˜”

Goes down to 84 for text, or binary designed to be text compatible if that's possible for a gif.

import os o,f=open,file o('Magic.gif','wb').write(o(f,'rb').read()[90:]) os.remove(f) Data

-1

u/mezantrop 21h ago

Ah, I didn't realize you were playing golf with Python. Lol. Anyway, that's brilliant! Now make it resurrect itself: Python β†’ GIF β†’ Python, and complete the challenge. :)

-2

u/letmehaveanameyoudum 17h ago

how iss this possible