|
Code Listing by bearophile - |
---|
|
To split a textual table automatically. Improved from a comp.lang.python request.
My first recipe here, it 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...
Python needs a unique function, this is my best try so far. It uses the faster algorithm (among five) for each situation.
This tries to be a safer and faster memoize decorator, it works with mutable types and with keyword args too. The code comes from many different versions found around. This code isn't much tested yet, so it must be used with care.
Two functions useful when you don't use a numerical library. The first one creates a tensor, hopefully in the correct way, avoiding the mutability trap. The second one transposes a 2D matrix keeping the type of the lists/tuples used.
To split a string more times, hierarchically.
A Heap wrapper class around the standard heapq, it helps avoid some common bugs with a useful OOP, and it manages a key parameter too.
Yet another implementation of an Odict, a dictionary in which the insertion order of items is preserved.
To quickly select the n-th rank ordered element of a given sequence. (It modifies the ordering of the given sequence).
This toy module shows a way to define symbols inside functions, using a decorator. Idea derived from recipe 303057 by Shai Berger. |
|
|
All files and free downloads are copyright of their respective owners. We do not provide any hacked, cracked, illegal, pirated version of scripts, codes, components downloads. All files are downloaded from the publishers website, our file servers or download mirrors. Always Virus check files downloaded from the web specially zip, rar, exe, trial, full versions etc. Download links from rapidshare, depositfiles, megaupload etc not published.