API Reference for Enthought Tool Suite 3.2.0
A collection of utility functions and classes FROM MATPLOTLIB.
Many (but not all) from the Python Cookbook -- hence the name cbook.
Example usage: sort = Sorter()
list = [(1, 2), (4, 8), (0, 3)] dict = [{'a': 3, 'b': 4}, {'a': 5, 'b': 2}, {'a': 0, 'b': 0}, {'a': 9, 'b': 9}]
sort(list) # default sort sort(list, 1) # sort by index 1 sort(dict, 'a') # sort a list of dicts by key 'a'
Example usage:
text = "Larry Wall is the creator of Perl" adict = { "Larry Wall" : "Guido van Rossum", "creator" : "Benevolent Dictator for Life", "Perl" : "Python", }
print multiple_replace(adict, text)
xlat = Xlator(adict) print xlat.xlat(text)
return true if all elements of seq compare equal. If seq is 0 or 1 length, return True
Return all possible pairs in sequence x
Condensed by Alex Martelli from this thread on comp.lang.python:
http://groups.google.com/groups?q=all+pairs+group:*python*&hl=en&lr=&ie=UTF-8&selm=mailman.4028.1096403649.5135.python-list%40python.org&rnum=1
delete all of the keys from the dict d
return all attributes of o which match string in match. if case is True require an exact case match.
this generator flattens nested containers such as
>>> l=( ('John', 'Hunter'), (1,23), [[[[42,(5,23)]]]])
so that
>>> for i in flatten(l): print i, John Hunter 1 23 42 5 23
By: Composite of Holger Krekel and Luther Blissett From: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/121294 and Recipe 1.12 in cookbook
Recurs all the files and dirs in args ignoring symbolic links and return the files as a list of strings
seq is a list of words. Return the index into seq such that len(' '.join(seq[:ind])<=N
Recursively list files from Parmar and Martelli in the Python Cookbook
Break up the seq into num tuples
empty a list
Should behave like python2.3 pop method; d is a dict
# returns value for key and deletes item; raises a KeyError if key # is not in dict val = popd(d, key)
# returns value for key if key exists, else default. Delete key, # val item if it exists. Will not raise a KeyError val = popd(d, key, default)
reverse the dictionary -- may lose data if values are not uniq!
soundex module conforming to Odell-Russell algorithm
remove latex formatting from mathtext
Return a list of unique elements of x
wrap text with prefix at length cols
| Local name | Refers to |
|---|---|
| errno | errno |
| generators | __future__.generators |
| os | os |
| re | re |
| StringIO | StringIO |
| sys | sys |
| traceback | traceback |
© Copyright 2002-2009 Enthought, Inc.