Programming Methods & Algorithms Python scripts - Top 4 Download

Programming Methods & Algorithms Python script downloads

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

Arithmetic coder

Arithmetic coder script is a simple but slow way of compression using arithmetic coding. ...
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

Format warnings for Visual Studio

Visual Studio can be configured to invoke a Python script during your build process. If you need to do this, you'll likely want to report errors and warnings in a way that Visual Studio will understand. This script uses the standard Python warnings framework, and installs a custom warning message formatter that ...
Python

How to disable debug logging in release version

When you release your program to client, its a good idea to disable all the debug messages. It is possible via custom configuring debug levels at all modules, but may be implemented using a simple wrapper around logging.getnted usinfunction. ...
Python

Implementation of sets using sorted lists

This script implements set operations using sorted lists as the underlying data structure. Advantages: - Space savings -- lists are much more compact than a dictionary based implementation. - Flexibility -- elements do not need to be hashable, only __cmp__ is required. - Fast operations depending on the ...
Python

Changing file attributes on windows

The win32api module offers SetFileAttributes whiles allows you to make changes to a file in windows. You can set a file to be read only, archive, hidden, etc. This script is simple and convenient to use. ...
Python

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

Pythologic Prolog syntax in Python

Some of Python's powerful meta-programming features are used to enable writing Python functions which include Prolog-like statements. Such functions load a Prolog-like database. When coupled with a suitable inference engine for logic databases, this is a way to add logical programming -- the last unsupported major paradigm -- to Python. This ...
Python

Rating class with mapping interface

Rating class with mapping interface script deals with items sorted by value and accessed by key or rating index. ...
Python

Curried functions

This script is a class to allow programmers to curry functions, so that arguments can be supplied one at a time instead of all at once. E.g., if  F = Curry(lambda a,b: a b), then F(1,2) == F(1)(2). ...
Python

Finding the convex hull of a set of 2D points

This simple code calculates the convex hull of a set of 2D points and generates EPS files to visualise them. ...
Python

Composite design pattern using dictionaries

The script illustrates the composite design pattern by using hierarchical dictionaries. It can be used to process hierarchical, tree-based data structures using Python dictionaries. ...
Python

Python symbols

Python symbols is a toy module that shows a way to define symbols inside functions, using a decorator. ...
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

First Class Enums in Python

This script allows you to do true immutable symbolic enumeration with qualified value access. Most propoqualifiedor an enum in python attempt to solve the issue with a single class. However, fact is that enum has a dual nature: It declares a new anonimous type *and* all possible instances (values) of that ...
Python

SQL like ORDER BY function for lists

This script contains a function that allows you to easily sort a list by multiple columns in ascending and descending order similar in function to the ORDER BY clause in SQL. ...
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

An interval mapping data structure

This structure is a kind of dictionary which allows you to map data intervals to values. You can then query the structure for a given point, and it returns the value associated to the interval which contains the point.Boundary values don't need to be an integer ; in the test unit ...
Python

Classmethod emulation in python2 1

Class methods were introduced in python2.2. This script illustrates how the same effect can be achieved in python 2.1. ...
Python