Re:You used Python for what?
by cadr on Friday March 23, 2012 @12:58PM
(#3746053)
I like doing codegolf in Python because it just feels so perverse. My golfed BF interpreter was way shorter than his :)
[ Parent
| on HN ]
Python lends itself quite nicely to code-golfing, that's true. In fact I am constantly amazed of how terse Python code can be, despite the significant whitespace stuff.
from os import*
r='s=[0]*8**5'
p=0
for c in read(0,9**9):r+='\n'+' '*p+dict(zip("><+-.,[","p+=1|p-=1|s[p]+=1|s[p]-=1|write(1,chr(s[p]))|s[p]=ord(read(0,1))|while s[p]:".split('|'))).get(c,'');p+=c in'[]'and 92-ord(c)
exec r
I know, it's a JIT compiler, not an interpreter, but still... :)