Programming Methods & Algorithms scripts - Top 4 Download

Programming Methods & Algorithms script downloads

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

Ensuring a name definition in a module namespace

This script ensures that a name exists in a target namespace. If it does not, make it available in the target namespace using the given definition. The target should be a namespace dictionary (presumably for a module, see the discussion below otherwise). The default target is __builtins__ (specificially, __builtins__.__dict__). ...
Python

Caching object creation

This script contains many recipes to memoize functions. Using this script you can cache object creation, i.e. __new__ and __init__ methods are called only when n.e. __newt;br >/ ...
Python

Auto Incrementer Example of call and yield

This script will automatically return the next integer. It starts with 0. This is an example of how to make a generator and how to make a callable object. ...
Python

Bag collection class

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

Constant Object Passing

This script shows you how to pass objects as "constant" (immutable) in python. ...
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

Static or Class Methods

This script implements class methods that do not require an object instance. ...
Python

Large File Sizes on 32 bit Windows

You can't use the os library to determine the size of large files on 32 bit Windows. This script uses the FindFiles win32call which provides among other things file size information. ...
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

z matrix

This module provides two classes that emulate one and two dimentional lists with fixed sizes but mutable internals. Their primary purpose is to be used as a building tool for classes that need storage structures that cannot change in size. ...
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

Lazy streams using generators

This class allows you to use generators as more list-like streams. The chief advantage is that it is impossible to iterate through a generator more than once, while a stream can be re-used like a list. ...
Python

Memento Closure

The memento pattern is great for transaction-like processing. This script adds transactional semantics to methods. Methods decorated with @transactional will rollback to entry state upon exceptions. ...
Python

Debuging of object instantiation

If you are debugging a program, this script will help you to know if some special objects exist and where they came from. ...
Python

TryFinally

This script is a convenient way to deeply nest try/finally statements. It is appropriate for complicated resource initialization and destruction. For instance, if you have a list of 50 things that need to get intialized and later destructed via using try/finally (especially if you need to create the list dynamically) this function ...
Python

Transposing a List of Lists

This script allows you to transpose a list of lists of different lengths. ...
Python

Splicing of lists

This script splices any number of nonempty lists as one list. Each input list may be of different length.Elements of shorter lists may be recycled when the keyword argument recycle is set to True. Any error result in an empty output list. ...
Python

Variant assertion

Variant assertion script is Eiffel like loop variant assertion. ...
Python