Programming Methods & Algorithms Python scripts - Top 4 Download

Programming Methods & Algorithms Python script downloads

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

Static or Class Methods

This script implements class methods that do not require an object instance. ...
Python

Storage for store information about prefixes

Storage for store information about prefixes script allows you to store information about domains determined by key prefixes. ...
Python

Summary reports using itertools groupby

This script produces a summary of the data, grouped by the given key (default: the first item), and giving totals of the given value (default: the second item). The key and value arguments should be functions which, given a data record, return the relevant value. ...
Python

Symmetric data obfuscation using xor

This script can be conveniently used to obfuscate a string of data using simple xor without using any key. ...
Python

Tabify

This script introduces a function that converts the indentation with spaces to tabs. ...
Python

Tail Call Optimization Decorator

This function decorates a function with tail call optimization. It does this by throwing an exception if it is it's own grandparent, and catching such exceptions to fake the tail call optimization. This function fails if the decorated function recurses in a non-tail contexif the de >/ ...
Python

Terminating a subprocess on Windows

The new subprocess module in Python 2.4 allows access to the handle of any newly created subprocess. You can use this handle to terminate subprocesses using either ctypes or the pywin32 extensions. ...
Python

The Singleton Pattern implemented with Python

This script contains a class that shows how to implement the singleton pattern in Python. A singleton is a class that makes sure only one instance of it is ever created. Typically such classes are used to manage resources that by their very nature can only exist once. ...
Python

Timeit module wrapper

This script contains a simple, easy to use wrapper function for doing quick tests of your functions using the timeit module.The timeit module provides an easy way of testing the performance of your Python code by running it in many iterations and averaging the timings. However it is not very obvious how ...
Python

Tkinter moving geometry methods

A common way to create new compound widgets is to inherit Frame, create everything you need inside it and pack this base Frame on your application.This script is an alternative to this method, that sets geometry methods and options from a wiget to another. ...
Python

Trace expressions and comments in debug mode

This script acts like a stepping debugger to diagnose and fix your programs. It contains functions for log state and execution flow. ...
Python

Tracking file requests in web server access logs

This script helps you to find out how often and by who a particular file is being requested. It prints the requesting addresses, hostnames, access times, and hit counts. ...
Python

Transposing a List of Lists

This script allows you to transpose a list of lists of different lengths. ...
Python

Treat the Win32 Registry like a Python dict

This class wraps most of the win32api functions for accessing a registry. It will read and write all win32 registry types, and will de/serialize python objects to registry keys when a string or integer representation is not possible. ...
Python

TryFinally

This script is a convenient way to deeply nest try/finally statements. It is appropriate for complicated resource initialization and destruction. For instance, if you have a list of 50 things that need to get intialized and later destructed via using try/finally (especially if you need to create the list dynamically) this function ...
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

Turing Machine Simulator

Turing Machine Simulator allows an arbitrary machine to be loaded. Words (represented as strings) can be ran against the simulator producing a response: Accept or Crash. ...
Python

Two pass Pairing Heap with Auxiliary List

This script allows you to manage data collections.For random data, this implementation still makes more comparisons than a sort using heapq or the builtin sort. For partially ordered data, it can perform better than the builtin sort. Because of the list of lists data structure, it always takes more memory than ...
Python

Type checked argument lists with decorators

This script shows you to use the new decorator feature of python 2.4 to systematically check the argument types for type-sensitive functions. ...
Python