Programming Methods & Algorithms Python scripts - Top 4 Download

Programming Methods & Algorithms Python script downloads

Auto Incrementer Example of call and yield

This script will automatically return the next integer. It starts with 0. This is an example of how to make a generator and how to make a callable object. ...
Python

Memento Closure

The memento pattern is great for transaction-like processing. This script adds transactional semantics to methods. Methods decorated with @transactional will rollback to entry state upon exceptions. ...
Python

Caching object creation

This script contains many recipes to memoize functions. Using this script you can cache object creation, i.e. __new__ and __init__ methods are called only when n.e. __newt;br >/ ...
Python

Call a function method X times per second

This simple generator function is used to call a function X times per second. ...
Python

Extending Classes

This script contains two implementations for extending an exsisting class using metaclasses. ...
Python

Remove duplicates from a sequence

The fastest way to remove duplicates from a sequence depends on some pretty subtle properties of the sequence elements, such as whether they're hashable, and whether they support full comparisons. This script defines the unique() function that tries three methods, from fastest to slowest, letting runtime exceptions pick the best method available for ...
Python

Composite design pattern using dictionaries

The script illustrates the composite design pattern by using hierarchical dictionaries. It can be used to process hierarchical, tree-based data structures using Python dictionaries. ...
Python

Separating Pattern Implementation from Your Code

This script separates pattern implementation from your code so that you can reuse the implementation elsewhere. It is an example that shows a reusable implementation of the Observer pattern. ...
Python

z sync

This script gives access to the Sync class. Objects created by the Sync class are meant to be used when trying to syncronize the execution of two or more threads. ...
Python

Rich Comparison Mixin

This script implements the full suite of rich comparison operators if __cmp__ is defined.The __cmp__ method is sufficient to provide comparisons between user-defined classes. However, inheriting from a base class (such as a builtin) which already provides the rich-comparison methods will cause the derrived __cmp__ not to be used. cause >the/ ...
Python

Right method names suggestion

This script uses __getattr__ to modify the error messages given when a wrong class method is called. It shows the first five ranked most similar method names, followed by the first line of their docstrings (this is useful to see their parameters, if you use this convention in your sources), and ...
Python

A simple date class

This script can be used by anyone who wants a date object for a program. The code was written as a help for someone trying to do the same thing in C . ...
Python

Metaclass Class Policies

This code implements the policy design pattern in Python by using metaclasses and multiple inheritance. ...
Python

Priority queue script

Priority queues are a kind of container that allows specification of the relative order of the data.   ...
Python

unzip

unzip script defines a function that represents the opposite of the zip function used for strings operations. As an alternative you could use the function call zip(zip()). ...
Python

Numeric base converter

This is a traditional base converter with the twist that it accepts any strings as the digits for the input and output bases. Besides all the normal base-converts, you can now create compact versions of huge numbers by converting them to a base that uses all the letters and numbers for ...
Python

Fifo as single linked lists

Fifo mean "First In First Out". This script  creates a container, which only allows element insertion and removal and where the first element inserted is the first element removed. ...
Python

Lazy streams using generators

This class allows you to use generators as more list-like streams. The chief advantage is that it is impossible to iterate through a generator more than once, while a stream can be re-used like a list. ...
Python

Anagram Fetcher

This script provides you code for fetching Anagrams out of any given file that contains words seperated by new lines. ...
Python

Reverse a string

Reverse a string script allows you to reverse a string. ...
Python