Programming Methods & Algorithms Python scripts - Top 4 Download

Programming Methods & Algorithms Python script downloads

Debug runtime objects using gc get objects

Since Python 2.2 there is a handy function in the Garbage Collection Module called get_objects(). It gives back a list of all objects that are under control of the Garbeage Collector. This script implements a way you can extract informations of your application in runtime.The example dumps a list of all ...
Python

Improved Gray Scale Quantization

Improved Gray Scale (IGS) codes are used for the elimination of false contouring in images, and image compression. This Python program generates the IGS codes for a set of input gray level values. ...
Python

Functional dictionary and list types

The purpose of this module is to provide a dictionary and list type that can aid in relational algebra, functional programming, list-oriented programming, and perhaps even code obfuscation. ...
Python

Grouping objects into disjoint sets

This class provides a lightweight way to group arbitrary objects together into disjoint sets when a full-blown graph data structure would be overkill. Objects can be joined using .join(), tested for connectedness using joined(), and all disjoint sets can be retreived using get(). The objects being joined must be hashable. ...
Python

High performance currying with instance method

This script implements the instance method for performing currying. Instance method provides a way to perform currying such that the curried function runs much faster than one produced by closure. Currying is an important technique to build callables on the fly and is well covered in other recipes. If the callables ...
Python

Dictionary Tools

Dictionary Tools script shows you a collection of some dictionary tools. ...
Python

Constellation Finder

The script demonstrates the use of SETs in Python. There is a key object that has constellations already identified and a stars object that contains the stars in the sky. Keys are used to unlocks the stars and the results are printed out for the user of the program. ...
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

Format number function

For many languages it is possible to use the locale module to format numbers. But there are at least three languages for which the locale.localeconv()['thousands_sep'] is empty: brazilian portuguese - 'pt_br', portuguese - 'pt' and spanish - 'es'. The first function, format_positive_integer() will return the passed integer number as a string ...
Python

kexec the newest linux kernel

Kexec is a mechanism to use linux itself to load a new kernel without going through the BIOS thus minimizing down time. This script kexecs the newest kernel on the system managed by rpm (assumes a Redhat like system). ...
Python

Watching a directory tree under Linux

This script contains a class named DirectoryNotifier that encapsulates the code required for watching directory entry contents. ...
Python

Example For winreg

This script is an example of how to use the winreg module. The code had the first purpose of demonstrating the concept of a graphical shell built in Python. The shell was easily modified to make use of the Window's registry but retains traces of its original method of operation. ...
Python

Class with default method handler

This script is a class whose objects can handle undefined method calls, passing them on to a default handler. ...
Python

Separating Pattern Implementation from Your Code

This script separates pattern implementation from your code so that you can reuse the implementation elsewhere. It is an example that shows a reusable implementation of the Observer pattern. ...
Python

Controlling Windows Services

This script is a module for manipulating WinNT, Win2k & WinXP services. It contains the WService Class. The WService Class is used for controlling WinNT, Win2k & WinXP like services. Just pass the name of the service you wish to control to the class instance and go from there. For example, ...
Python

z sync

This script gives access to the Sync class. Objects created by the Sync class are meant to be used when trying to syncronize the execution of two or more threads. ...
Python

Debug statements include function name

This script allows a user to place debug messages, error messages and standard messages throughout a program. The function name and line number will be added to each debug and error message before it is printed out. In addition, each of these messages can be passed to multiple handler objects that can ...
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

Shed Skin

Shed Skin is an experimental Python-to-C compiler. It can convert pure, but implicitly statically typed Python programs into optimized C code. Currently, these programs cannot freely use the Python standard library. ...
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