TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Obfuscating “Hello World” in Python

285 pointsby carljosephover 10 years ago

10 comments

mantoover 10 years ago
When I first saw the final code, I thought it unfathomable that I could resolve it down to "Hello World!" at any point in my lifetime. The following 20min provided an education into logic, programming, and Python that rivals 200 page reference books with clear explanations and the ideal amount of build up for each step. Thanks Ben for the post!
rrosen326over 10 years ago
I thought this was a great post, some amazing code, and humbling since this is WAY beyond my current - and future - ability.<p>Even more impressive - it looks like the author is a freshman in college! <a href="https://www.linkedin.com/in/benkurtovic" rel="nofollow">https:&#x2F;&#x2F;www.linkedin.com&#x2F;in&#x2F;benkurtovic</a><p>Nice work, Ben!
评论 #8774073 未加载
hawkiceover 10 years ago
This is perhaps the clearest example on the value of implementation-oriented code comments. When you need them, they are superheroic. But... don&#x27;t need them, please.
userbinatorover 10 years ago
I barely know any Python and upon first glance I could easily get an idea of how it worked (without looking at the explanation): by computing the required strings out of funny-named variables with shifts and arithmetic. co_nlocals is obviously the only actual integer constant from which all the other values are coming from.<p>Only then did I read the explanation, and realised I wasn&#x27;t far-off (the only thing I got wrong was the string computation, which I thought would be a string concatenation.) I think it says something about the language when even <i>obfuscated</i> code in it is rather readable! (Then again, I do RE where most of the code I&#x27;m reading is disassembled machine instructions, so maybe my perspective on what constitutes obfuscation is a bit skewed...)
axottyover 10 years ago
&quot;There should be one-- and preferably only one --obvious way to do it.&quot;
评论 #8773252 未加载
dangayleover 10 years ago
I saw this yesterday and shared it with a friend who had introduced me to code golf. Simply fantastic, particularly the comments.
cogburnd02over 10 years ago
I didn&#x27;t realize there needed to be an IOPCC but now I do.
WillyNoursonover 10 years ago
This is like brainf*ck to me.
评论 #8772952 未加载
curiouslyover 10 years ago
the level of obfuscation is impressive. i wonder if similar obfuscation for javascript exists? The one from google doesn&#x27;t seem to quite work right and end up breaking my script. The paid version from jscrambler seems to work but seems like a large waste of money to obfuscate one file.
gbersacover 10 years ago
This code is so ugly that I thought it was Lisp :p