Programming Methods - Algorithms



Readable switch construction Download

Friday, May 30th, 2008

Python’s lack of a ’switch’ statement has garnered much discussion and even a PEP.

The most popular substitute uses dictionaries to map cases to functions, which r

wxParser Download

Thursday, May 29th, 2008

wxParser allows you to parse documents with regular expression to the tree and edit them or replace some of the data, powered by your own python code.

Python is ver

Registry Wrapper Download

Thursday, May 29th, 2008

This script provides "Registry", a Windows registry wrapper class that makes it easy to work with the Windows registry.

The class works with an inner

Clean implementation for Ordered Dictionary Download

Thursday, May 29th, 2008

This script allows you to record the order in which items are added. This implementation uses much less code than the others by extending not well-known class DictMixin.

Keyed Dictionary Download

Tuesday, May 27th, 2008

The KeyedDict object keeps a list of approved key values. If you try to assigned an unapproved key to a value, an exception is thrown.
When you create the object, y

Grab a part of a web page Download

Monday, May 26th, 2008

This script grabs a part of a web page and generarte a new page with a base href to the source server, so that relative links will still work.

Text Sanitizer Download

Monday, May 26th, 2008

Reads through files and replaces swear words with euphemisms. Uses regular expressions in order to also match common ways to circumvent censors. ("d@mn","h3ll&qu

RICHVALUE Download

Sunday, May 25th, 2008

While evolving code, there is often a need to enrich an existing simple return scheme of a function by extra/optional return values.

Using (variable lenght) return

Deque collection class Download

Sunday, May 25th, 2008

This script is a pure python drop in replacement for collections.deque(). It uses a dictionary as the underlying data structure for the deque (pronounced "deck", short f

Dictionary with attribute-style access Download

Saturday, May 24th, 2008

This script defines a dictionary with attribute-style access. It maps attribute access to the real dictionary.

It can be easier to read and type data access us