How to give extra arguments for the Python itertools.ifilter function?

Posted by Peter Smit on Stack Overflow See other posts from Stack Overflow or by Peter Smit
Published on 2010-03-20T13:09:57Z Indexed on 2010/03/20 13:11 UTC
Read the original article Hit count: 356

Filed under:
|
|

In python I have the following function:

def is_a_nice_element(element, parameter):
    #do something
    return True or False

Now I would like to filter a list with this function as predicate, giving a fixed parameter. Python has the itertools.ifilter function, but I can't figure out how to pass the parameter. Is this possible? If not, how can I solve this problem?

© Stack Overflow or respective owner

Related posts about python

Related posts about itertools