Programming Methods & Algorithms Python scripts - Top 4 Download

Programming Methods & Algorithms Python script downloads

More accurate sum

Built-in "sum" function, as well as add.reduce functions in Numeric/numarray introduce a large error when summing large arrays of like elements. This script contains a function that makes sums with error less than 1e-15. It doesn't use any additional memory (although it destroys the data array), and also runs asymptotically faster for unlimited precision ...
Python

Named Tuples

This script allows you a fast, lightweight attribute-style access to tuples. It contains a function that returns a new subclass of tuple with named fields. The principal features are: - Easy to type/read/modify function signature: NamedTuple('Person', 'name age sex height nationality')  - C-speed attribute lookup using property and itemgetter. - No ...
Python

Network Of Linked Dictionaries

Linked dictionaries are dictionaries that can refer to other dictionaries (its bases), similar to class hierarchies, but built at runtime. In this script  a linked dictionary shows all the key/value pairs that are defined locally (in the very instance) and globally (in other linked bases). ...
Python

New Tail Recursion Decorator

This tail recursion decorator can eliminate the tail calls for recursive functions. ...
Python

Null Object Design Pattern

This script is a sample implementation of the 'Null Object' design pattern. Roughly, the goal with Null objects is to provide an 'intelligent' replacement for the often used primitive data type None in Python or Null (or Null pointers) in other languages. These are used for many purposes including the important case ...
Python

Number Format function

This function takes a number (integer or float) and returns a string with the integer portion grouped by thousands and the decimal portion rounded or padded to given number of decimal places. ...
Python

Numeric base converter

This is a traditional base converter with the twist that it accepts any strings as the digits for the input and output bases. Besides all the normal base-converts, you can now create compact versions of huge numbers by converting them to a base that uses all the letters and numbers for ...
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

Obtaining the name of a function method

This scripts shows you how to obtain the name of a method or a function from within the running method/function. ...
Python

Octal Encryption

This script helps you to get the octal representation of text. ...
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

Padding variable length sequences

Padding variable length sequences script returns a pad function that implements tuple unpacking. ...
Python

Parse Command Line String from CommandLine

This script represents a way to parse command line from user provided string or try to get the original Argv from Windows OS Platform. ...
Python

Parsing the command line

The module optparse was a great addition to Python 2.3, since it is much more powerful and easier to use than getopt. Using optparse, writing command-line tools is a breeze. However, the power of optparse comes together with a certain verbosity. This script allows to use optparse with a minimum of boilerplate, ...
Python

Permutation

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

Pipe convenience function for doing pipes

This script allows that arbitrary number of commands to be strung together with each one feeding into the next ones input. ...
Python

pkgconfig parser

This script creates a class to allow access to variables stored in pkg-config files ( or '.pc' files ). This is usefull in conjunction with distutils to get correct information for compiling external C/C modules. Variable substitution is performed with string.Template. ...
Python

Poker hand primitives

This script handles logic for detecting straights and groups of repeats in the presence of wildcards and hands with more than five cards. ...
Python

Print Hook

This class gets all output directed to stdout (e.g by print statements) and stderr and redirects it to a user defined function. ...
Python

Priority queue script

Priority queues are a kind of container that allows specification of the relative order of the data.   ...
Python