Programming Methods & Algorithms scripts - Top 4 Download

Programming Methods & Algorithms script downloads

Real class methods in Python

This script demonstrates 'real' class methods, like they are known from Smalltalk. Class methods implicitely receive the actual class as the first parameter. They are inherited by subclasses, and may as well be overridden. Class methods may return anything, although they are particularly useful as constructing, althbr >/ ...
Python

A basic time profiler

A basic time profiler script provides a very simple time profiling module which helps you to measure actual execution time for blocks of Python code. ...
Python

A basic undo mechanism

This script provides a basic undo mechanism. The undo mechanism is build on top of the observer pattern. The basic undoer records all parameters needed to undo the change of attributes. ...
Python

A class keeps a reference to it s instance

This script implements a base class, which allows derived classes to track instances in self.__instances__. It uses a WeakValueDictionary to store instance references. ...
Python

A friendly mkdir

This scripts provides a function mkdir() more friendly than Python's standard os.mkdir(). Limitations: it doesn't take the optional 'mode' argument yet. ...
Python

A general solution of Eight Queens

This script is a general method to figuren out all solutions of eight queens. Certainly, it can also solve any number of queens. Each solution is a list, and each value of the list represents the column number, at the same time the index of this value represents it's row number. For instance, ...
Python

A generator for any number of for loop

Python has a number of nice methods to handle 'for' loops. However, the situation often arises where you have a large number of nested loops. This script allows you to reduces the number of loops to one. ...
Python

A List of Dictionaries

This  class emulates a list of dictionary objects without the memory and pickle storage overhead which occurs when storing every item in the list as a dictionary. ...
Python

A meta class that provides behavior like Ruby

This script brings a Ruby-like class behavior. When a class is declared, it extends the old class if the class name exists already. ...
Python

A queue for string data

This script is a queue data structure, for string data only, which looks like a File object. This class takes care of the list.append and .join mess, which is needed for fast string concatenation. ...
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

A tidy property idiom

This script suggests an idiom for property creation that avoids cluttering the class space with get/set/del methods that will not be used directly. Using thel methods idiom to create properties unnecessarily clutters the class space with get/set/del methods that will not be called directly by users of your class (although, of course, ...
Python

AbstractFactory

This script has a base Factory class that is meant to be subclassed and then define a default implementation to return, as well as module's to search for the class implementation. ...
Python

All k subsets from an n set

This script yields each subset of size k from a super set of size n. There are two methods. The first operates on sets of integers of the form range(n). The seconds operates on arbitrary sets or lists. ...
Python

Allowing the Python profiler to profile C modules

This script lets you take into account time spent in C modules when profiling your Python code. Normally the profiler only profiles Python code, so finding out how much time is spent accessing a database, running encryption code, sleeping and so on is difficult. Profilewrap makes it easy to profile C ...
Python

An interval mapping data structure

This structure is a kind of dictionary which allows you to map data intervals to values. You can then query the structure for a given point, and it returns the value associated to the interval which contains the point.Boundary values don't need to be an integer ; in the test unit ...
Python

Anagram Fetcher

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

Arithmetic coder

Arithmetic coder script is a simple but slow way of compression using arithmetic coding. ...
Python

Arrayterator

This class creates a buffered iterator for reading big arrays in small contiguous blocks. The class is useful for objects stored in the filesystem. It allows iteration over the object without reading everything in memory; instead, small blocks are read and iterated over. The class can be used with any object ...
Python

ASTVisitor generator

This script parses the online documentation for compiler.ast and generate code for a skeletal ASTVisitor class that includes stubs for all of the various visitNODE functions that you might need in a visitor, along with comments in each function that list that node type's attributes. ...
Python