Programming Methods & Algorithms Python scripts - Top 4 Download

Programming Methods & Algorithms Python script downloads

Yet another Set class for Python

This script is a pure Pythonic implementation of a set class. The syntax and methods implemented are, for the most part, borrowed from PEP 218. ...
Python

Factory pattern

In the factory pattern script you have an object that creates other objects.Factory is useful to separate implementation from interface. It adds a new indirection layer. When you want to instanciate an object you call its factory and the factory creates the instance. ...
Python

Scope qualifier for globals

Scope qualifier for globals script contains the globaliser class that provides a scope qualifier s the glols. ...
Python

Interfaces

Interfaces script deals with the Interface concept in Python. ...
Python

Options management

The goal of this script is to help the use of classes that need a great number of options in constructor for configuration. ...
Python

Just in time instantiation

JIT is a class for Just In Time instantiation of objects. Init is called only when the first attribute is either get or set. Then automatic delegation is used to front for the object. ...
Python

Memento design pattern in python

Memento design pattern in python script allows you to cache instances based on what arguments are passed to them. ...
Python

Simplified attribute accessors using overloading

This script presents an ideom for simplified accessors, that combines typical getter and setter functionality of an attribute into a single overloaded method, that instead of getATTRIBUTE and setATTRIBUTE can now just be called ATTRIBUTE. When called without arguments it acts as a getter and retrieves the attribute's value. When called ...
Python

Tuples with Named Elements via Spawning

Instead of requiring the named attributes list for each instantiation of the tuple, this implementation 'Spawns' a derived tuple class that is taylored to the named attributes specified. And it is this Spawned class that is then used to instantiate tuples. This approach effectively separates the definition of the attribute names from the ...
Python

Quasi Singleton Metaclass

In effect, this script provides a pattern for a set of quasi-singletons, identified by keyword. If no keyword is given, the default share is accessed. ...
Python

Create objects from variable class names

Sometimes you would want to create objects from various classes based on some condition (without using eval()). For example when parsing X(HT)ML files you want to handle some tags using specific classes. This script is an example in this sense. ...
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

Observer Pattern

This is a Python implementation of the observer pattern. It defines a one-to many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically. ...
Python

Stateful Objects use Mix ins to define behaviour

If you want to implement stateful objects, which have a different set of behaviours according to what state they are in, this requirement can be achieved with the use of mix-ins. A mix-in is a class which is dynamically inherited by an object. The methods of the mix-in class are thus ...
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

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

Drawing inheritance diagrams with Dot

Dot is a very nice graph description language developed at MIT. Combined with Python, it makes an ideal tool to automatically generate diagrams. This script produces beautiful inheritance diagrams for Python classes (and metaclasses too). In particular the recipe allows to display the MRO (Method Resolution Order) for complicate inheritance hierarchies. ...
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

Function emulation using call

This script defines a simple but useful class that emulates a function to gracefully permit latent assignment. In other words, you can use the emulating class as a valid function in assignments with the ability to later associate a function to perform the actual operations. ...
Python

Maintenance free Signals implementation

This is a signals implementation for python. It is similar to the pydispatch module. This implementation enables you to create Signals as members of classes, as globals, or as locals. You may connect any number of functions or class methods to any signal. Connections manage themselves with the weakref module. Signals ...
Python