r/ProgrammerHumor 1d ago

Meme purePythonMagic

118 Upvotes

22 comments sorted by

View all comments

-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

0

u/mezantrop 1d ago

Show me your kung fu 😏

0

u/QuestionableEthics42 23h 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 22h 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. :)