cc-4105: added docstrings for partition function

This commit is contained in:
Rudi Grinberg 2012-07-20 17:30:22 -04:00
parent bd5688a484
commit 32c3068089
1 changed files with 6 additions and 1 deletions

View File

@ -46,7 +46,12 @@ class IncludeOnly(object):
def partition(f, alist):
# TODO : document this function and add doctests
"""
Partition is very similar to filter except that it also returns the elements for which f
return false but in a tuple.
>>> partition(lambda x : x > 3, [1,2,3,4,5,6])
[4,5,6],[1,2,3]
"""
return (filter(f, alist), filter(lambda x: not f(x), alist))
def is_file_supported(path):