Live data from Hacker News

Ask HN: Good python code for code reading

news.ycombinator.com

11–20 of 23 posts

Re: Ask HN: Good python code for code reading

#12
post #9
post #8

Earlier quoted context omitted.

This was a major eye-opener for me as-well. I jumped into various python modules and was amazed at what I discovered. Like the easter-egg hidden away in "this.py": http://pastebin.com/f25f08f20 (Couldn't figure out how to get code formatting to work properly)

Ha. All that code at the bottom of the file could be replaced by "print s.decode('rot13')" - I suppose it's backwards compatible though...

Or forward-compatible, since encode/decode in py3k is between bytes and unicode only.

Re: Ask HN: Good python code for code reading

#19
post #10

It's an essay that contains code, but this is one of my all time favorites: Peter Norvig writes a spelling corrector in 21 lines of Python: http://norvig.com/spell-correct.html

Norvig's sudoku-solving essay is pretty awesome, too (100 lines of Python).

http://norvig.com/sudoku.html

Post reply on HN