Wednesday, October 12, 2011

Aliased Circles

Inspired by this I wrote a little script to create antialiased circles in python
The Gist:
Example output:

Monday, October 3, 2011

difflib

Found another standard library gem: difflib, which allows you to do intelligent string comparisons.

For example:

will find the longest palindrome in a string, e.g.
>>> from palindrome import *
>>> longest_palindrome('asdfracecarasdf')
'racecar'
>>> longest_palindrome('asdffasdfaipreferpiasdfasdfa')
'aipreferpia'