Programming Methods & Algorithms Python scripts - Top 4 Download

Programming Methods & Algorithms Python script downloads

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

Class with default method handler

This script is a class whose objects can handle undefined method calls, passing them on to a default handler. ...
Python

Changing return value for mutating list methods

Mutating list methods such as 'append' or 'extend' return None instead of the (mutated) list itself. Sometimes, this is not the desired behaviour. To have a reference to the (mutated) list returned is usefull, if one wants to chain commands such as mylistinstance.append(7).sort(). ...
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

Solving the Metaclass Conflict

Any serious user of metaclasses has been bitten at least once by the infamous metaclass/metatype conflict. This script contains a general recipe to solve the problem, as well as some theory and some examples. ...
Python

Public and protected attribute access

This script presents a way to introduce proper attribute access protection levels using a generic proxy object. By default all attributes are "protected" in the C sense and can be declared as public using either a function decorator or a class attribute. ...
Python

Rebind class properties

Sometimes you define properties in base class and override the getter setter methods in derived classes. Then you find out the base class though has derived properties are still pointing to baseclasse's methods not the overriden ones. ...
Python

Dictionary tool for lazy typers

This script provides an alternative way of generating and updating dictionaries. It saves couple of keystrokes, making routine dict operations easier. ...
Python

Exception based Switch Case

This script presents you another way to emulate a switch-case statement, perhaps one you might not have thought of. ...
Python

Example For winreg

This script is an example of how to use the winreg module. The code had the first purpose of demonstrating the concept of a graphical shell built in Python. The shell was easily modified to make use of the Window's registry but retains traces of its original method of operation. ...
Python

Extensible object to XML converter

This function generates XML for any Python object through recursive functions. It is easy to add specific handlers for your own object types for more complex output options. ...
Python

Remote control with telnetlib

This script sends commands to one or more logins using Python's standard telnetlib module. ...
Python

Constant Object Passing

This script shows you how to pass objects as "constant" (immutable) in python. ...
Python

Windows registry

This script allows you to store some data for your progam in the windows registry without many complex operations. ...
Python

Get system language dependent paths on windows

This module provides a few functions to retrieve the path names of some windows system directories from the registry and the environment. These path names can be different depending on OS version, installation language, current user and personal setup. Because of this, they should not be included statically in your program. ...
Python

Function composition

This script contains two classes that show two styles of function composition. The difference is only when the second function (g) returns a tuple. compose function passes the results of g as a tuple, mcompose treats it as a tuple of args to pass along. Note that extra args provided to (m)compose are treated ...
Python

Sieve of Eratosthenes

This script computes an infinite sequence of primes using simple generators. A Python dictionary is used to mark multiples of the generated primes, according to the Sieve of Eratosthenes. ...
Python

Permutation

This script contains a small but efficient recursive function for printing the permutation of characters in a given string. ...
Python

Loop over and descend into sequences

This is a function to iterate over a container and its elements that checks for recursive traps. The condition for descending into elements is highly configurable (a list of type() results, or a callable). ...
Python