Programming Methods & Algorithms Python scripts - Top 4 Download

Programming Methods & Algorithms Python script downloads

List Generator Monad Combinators

The List monad in Haskell has many uses, including parsing and nondeterministic algorithms. This code implements the Monad combinators "bind", "return" and "fail", and the MonadPlus combinators "plus" and "zero". It works with all iterables, and returns a generator rather than a list in order to preserve a lazy semantics. ...
Python

List iterator with advance and regress

The basic iterator for a list doesn't allow one to skip forward (except with "continue"), or backward (at all), nor does it behave well if the list is modified while it is being traversed. This script is NOT the be-all and end-all of improved iterators, but it gives a few ideas of how a ...
Python

Load data in browser without using temp files

This script displays the html files in the default web browser without creating a temp file. It instantiates a trivial http server and calls webbrowser.open with a URL to retrieve html from that server. ...
Python

Lock NT via screensaver

Lock NT via screensaver code implements a Python solution for locking a workstation via a secure screensaver. ...
Python

Logging to a Jabber account

This script contains a handler class which sends a Jabber message for each logging event. If you have long-running scripts on many remote machines and you want to be alarmed if one of them crashes, use the JabberHandler to log it to your account. ...
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

Loose Coupling

The "broadcaster" and "broker" modules enable loose coupling between objects in a running application. ...
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

Manipulating infinite lists

This script contains some useful functions which work on infinite lists, including generalized versions of map, filter, zip on gLists. ...
Python

Matrix vector multiplication

Using 'reduce' and 'map', this code shows how a matrix vector multiplication can be reduced to a single loop. ...
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

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

Memoize Decorator with Timeout

This simple decorator is different to other memoize decorators in that it will only cache results for a period of time. It also provides a simple method of cleaning the cache of old entries via the .collect method. This will help prevent excessive or needless memory consumption. ...
Python

Memory usage

Memory usage script provides a number of functions to get the memory usage of a Python application on Linux. ...
Python

Merge sorted sequences

The usual approach to merging is to loop through both sequences taking the smallest from each until they are both exhausted. Python's "timsort" function detects order in underlying sequences and will run a C speed merge on the data. So, all that is involved is concatenating the sequences and running a ...
Python

Merging sorted iterables

This script helps you to merge sorted iterables, preserving ordering,without consuming iterables (and computing time) unnecessarily. ...
Python

Merging two sorted iterators

Merging two sorted iterators script provides a mergeiter() function that can merge two iterators into a single iterator. It uses generators, and guarantees constant memory use. ...
Python

Metaclass Class Policies

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

min max peaks with Numeric

Given a large one-dimensional array, this script breaks it into blocks of contstant length and compute min and max for each block, the so-called "peaks data". ...
Python

Missed SIGINT in multithreaded programs

Multithreaded Python programs often ignore the SIGINT generated by a Keyboard Interrupt, especially if the thread that gets the signal is waiting or sleeping. This module provides a workaround by forking a child process that executes the rest of the program while the parent process waits for signals and kills the ...
Python