/python-gems

Beautifully constructed python scripts

Primary LanguagePython

Python Gems


A collection of python scripts that solve interesting problems.

  • async_sched.py - A asynchronous scheduler implemented using coroutines, in principle similar to Tornado's ioloop

  • config_parser.py - My implementation of python standard library's ConfigParser module

  • dancing_links.py - My implementation of Dr. Knuth's dancing links algorithm, with a demo to solve N-Queen problem

  • disjoint_set.py - Disjoint set is a very important data structure, this is my naive implementation

  • fileinput.py - My implementation of python standard library's fileinput module

  • go_repl.py - A REPL for golang, support executing Go statements with instant feedback

  • html_template.py - A simple html template engine, supporting similar syntax as Django template language

  • lisp.py - A Lisp parser implemented in python, inspired by Peter Novig's essay

  • memento.py - Very elegant memento design pattern impl, copied from activestate recipes

  • patch_module.py - Patch python modules lazily, only when they are imported

  • quine.py - A python script to print itself

  • rpc.py - Simplistic RPC for python

  • timeit.py - My partial implementation of standard library's timeit module

  • emojify - Render an image with emoji's based on the colors in original image

  • web_terminal - A remote console from a web browser

  • online_judge - A OJ system like leetcode, with a small problemset, supporting only python solutions

  • image_crawler - A web image crawler written based on Tornado

  • http_server - A basic http server supporting static files/wsgi apps/proxying