Programming Methods & Algorithms scripts - Top 4 Download

Programming Methods & Algorithms script downloads

CookieInfo

The "CookieInfo" and "Cookie" classes provide developers with an read-only interface to the "cookies.txt" that most browsers store. The CookieInfo class makes Cookie objects from the cookie file. It also provides methods to operate on the whole set of Cookies. The Cookie object provides methods to convert a cookie into both ...
Python

Padding variable length sequences

Padding variable length sequences script returns a pad function that implements tuple unpacking. ...
Python

IPv4 address set type

IPv4 address set type script initializes an ip4range class.The constructor accepts an unlimited number of arguments that may either be tuples in the form (start,stop), integers, longs or strings, where start and stop in a tuple may also be of the form integer, long or string. Passing an integer or long ...
Python

Splitting up a sequence

This script allows you to split up a sequence in same-size (if possible) parts. ...
Python

Dictionary Mixin Framework

This script makes it easy to provide a full dictionary interface to a class defining only a few mapping methods for getting, setting, deleting, and listing keys. Also, a function is provided to incorporate the mixin at runtime so that code for existing modules need not be modified.By usmodules nixin as a superclass, ...
Python

Merging sorted iterables

This script helps you to merge sorted iterables, preserving ordering,without consuming iterables (and computing time) unnecessarily. ...
Python

Merge sorted sequences

The usual approach to merging is to loop through both sequences taking the smallest from each until they are both exhausted. Python's "timsort" function detects order in underlying sequences and will run a C speed merge on the data. So, all that is involved is concatenating the sequences and running a ...
Python

Two pass Pairing Heap with Auxiliary List

This script allows you to manage data collections.For random data, this implementation still makes more comparisons than a sort using heapq or the builtin sort. For partially ordered data, it can perform better than the builtin sort. Because of the list of lists data structure, it always takes more memory than ...
Python

Generator for integer partitions

Generator for integer partitions script uses an iterative procedure to deal with integer partitions. ...
Python

A tidy property idiom

This script suggests an idiom for property creation that avoids cluttering the class space with get/set/del methods that will not be used directly. Using thel methods idiom to create properties unnecessarily clutters the class space with get/set/del methods that will not be called directly by users of your class (although, of course, ...
Python

New Tail Recursion Decorator

This tail recursion decorator can eliminate the tail calls for recursive functions. ...
Python

Restrictive APIs for Python

Python has no inherent provision for a restrictive API that blocks accesses to methods and variables outside an allowed set. Inexperienced Python programmers may fail to adhere to an agreed-upon API, directly accessing the private internals of a class. Adherence to defined APIs is a good thing. This script contains a  ...
Python

Merging two sorted iterators

Merging two sorted iterators script provides a mergeiter() function that can merge two iterators into a single iterator. It uses generators, and guarantees constant memory use. ...
Python

Interfaces

Interfaces script deals with the Interface concept in Python. ...
Python

Exception based Switch Case

This script presents you another way to emulate a switch-case statement, perhaps one you might not have thought of. ...
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

Remove duplicates from a sequence

The fastest way to remove duplicates from a sequence depends on some pretty subtle properties of the sequence elements, such as whether they're hashable, and whether they support full comparisons. This script defines the unique() function that tries three methods, from fastest to slowest, letting runtime exceptions pick the best method available for ...
Python

Loop over and descend into sequences

This is a function to iterate over a container and its elements that checks for recursive traps. The condition for descending into elements is highly configurable (a list of type() results, or a callable). ...
Python

Force verbose mode for unittests in an IDE

When running unit tests, using the verbose flag often provides an extra level of protection against mistakes. When running from the command line, this simply means adding the -v option. If you use an IDE, matters become more complicated. While you can often set your IDE to pass in the -v ...
Python

Windows free drive space report

Windows free drive space report script reads a file containing a list of share names, and prints a report of the current free space on the volumes. ...
Python