Programming Methods & Algorithms Python scripts - Top 4 Download

Programming Methods & Algorithms Python script downloads

Getting SYSTEM environment variable under Windows

This script allows you to get SYSTEM environment value, as if running under Service or SYSTEM account.As you can see in Windows Control Panel 'System' applet there are two groups of environment variables: USER and SYSTEM. This script presents a function for retrieve SYSTEM variable value.  ...
Python

Constraint based Sudoku Solver

This code uses the constraint package to solve sudoku puzzles. It's designed to be flexible and tested with 9x9 puzzles with 1-9 as possible values. In theory it should be able to solve puzzles of different sizes comprised of letters or symbols instead of numbers. Requirements: · constraint package ...
Python

A general solution of Eight Queens

This script is a general method to figuren out all solutions of eight queens. Certainly, it can also solve any number of queens. Each solution is a list, and each value of the list represents the column number, at the same time the index of this value represents it's row number. For instance, ...
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

Matrix vector multiplication

Using 'reduce' and 'map', this code shows how a matrix vector multiplication can be reduced to a single loop. ...
Python

Anagram Fetcher

This script provides you code for fetching Anagrams out of any given file that contains words seperated by new lines. ...
Python

Basic Linear Algebra Matrix

This script defines the Matrix class, an implementation of a linear algebra matrix. Arithmetic operations, trace, determinant, and minors are defined for it. This is a lightweight alternative to a numerical Python package for people who need to do basic linear algebra. Vectors are implemented as 1xN and Nx1 matricies. There is ...
Python

Scramble Word

Scramble word script re-arrange characters of word by using simple string manipulation and Random module. ...
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

Python Octree Implementation

This script is a simple implementation of an octree data structure in python. Its use is primarily for fast collision or view frustrum culling in interactive 3d environments, but its possible uses are quite open-ended. It was originally written for use with the pyOgre 3d engine binding. The code makes use of ...
Python

Caching decorator with timeout invalidation

This script is a caching decorator that  collects garbage in a separate thread (for performance).It allows each cached function to (optionally) set a custom maximum age for entries, and allows individual cache entries to be selectiries, andlidated.This kind of caching decorator is often useful in web development, when your pages are ...
Python

Lazy attributes

Lazy attributes script shows how to create attributes with 'computed at first use' values. ...
Python

Convex hull and diameter of 2d point sets

This script returns the convex hull (separated into upper and lower chains of vertices) and the diameter (farthest pair of points), given input consisting of a list of 2d points represented as pairs (x,y). The convex hull algorithm is Graham's scan, using a coordinate-based sorted order rather than the more commonly ...
Python

z crypt

This module show a way to simple data encryption. Characters are mapped to a key via replacement. Though simple, this is a good method for encrypting data if the data is compressed before or after the encryption process. The functions provided by this recipe are meant to be used in a ...
Python

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

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

Random Password Generation

Random Password Generation script is a code snippet to generate an 8 character alphanumeric password. ...
Python

A meta class that provides behavior like Ruby

This script brings a Ruby-like class behavior. When a class is declared, it extends the old class if the class name exists already. ...
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