Programming Methods & Algorithms Python scripts - Top 4 Download

Programming Methods & Algorithms Python script downloads

Reverse a string

Reverse a string script allows you to reverse a string. ...
Python

Rich Comparison Mixin

This script implements the full suite of rich comparison operators if __cmp__ is defined.The __cmp__ method is sufficient to provide comparisons between user-defined classes. However, inheriting from a base class (such as a builtin) which already provides the rich-comparison methods will cause the derrived __cmp__ not to be used. cause >the/ ...
Python

Implementing Future s with decorators

This script shows you how to kick off a slow process without waiting around for the result. The process is run in the background until the value is actually needed at which time it blocks until the value is ready. ...
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

Lock NT via screensaver

Lock NT via screensaver code implements a Python solution for locking a workstation via a secure screensaver. ...
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

Terminating a subprocess on Windows

The new subprocess module in Python 2.4 allows access to the handle of any newly created subprocess. You can use this handle to terminate subprocesses using either ctypes or the pywin32 extensions. ...
Python

Some python style switches

Some python style switches script shows several ways of making a 'switch' in pyshows sevbr >/ ...
Python

Priority queue script

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

Deque collection class

This script is a pure python drop in replacement for collections.deque(). It uses a dictionary as the underlying data structure for the deque (pronounced "deck", short for "double-ended queue", a generalization of stacks and queues) which provides O(1) performance for appends and pops from either end.   ...
Python

Right method names suggestion

This script uses __getattr__ to modify the error messages given when a wrong class method is called. It shows the first five ranked most similar method names, followed by the first line of their docstrings (this is useful to see their parameters, if you use this convention in your sources), and ...
Python

Changing a closed over value in a cell

In most languages with closures, it is possible to change a closed-over value and have the change visible in other closures which share a reference to the same variable. Python's syntax makes this impossible. Putting your changeable values inside a mutable object like a list-- it may occasionally happen that you ...
Python

Case insensitive Dictionary

Case-insensitive Dictionary script is a dictionary that has case-insensitive keys. An internal dictionary maps lowercase keys to (key,value) pairs. All key lookups are done against the lowercase keys, but all methods that expose keys to the user retrieve e lowercanal keys. ...
Python

Bag collection class

Bag collection class script implements Smalltalk's bag class. ...
Python

Automatic indentation of output

This script is an output stream wrapper; possibly useful for debugging code with print statements. When write() is called, it makes a note of the calling frame. The indentation level is equal to the number of frames in the call stack which have been previously noted. ...
Python

Constant Object Passing

This script shows you how to pass objects as "constant" (immutable) in python. ...
Python

A List of Dictionaries

This  class emulates a list of dictionary objects without the memory and pickle storage overhead which occurs when storing every item in the list as a dictionary. ...
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

Quasi Singleton Metaclass

In effect, this script provides a pattern for a set of quasi-singletons, identified by keyword. If no keyword is given, the default share is accessed. ...
Python

Read write object for pkg config files

The PkgConfig class is useful by itself. It allows reading and writing of pkg-config files. This file, when executed, will read a .pc file and print the result of processing. The result will be functionally equivalent, but not identical. Re-running on its own output should produce identical results. ...
Python