You will need to define a "checklims" function such that it carries around
extra information. It needs a context, which dictates an object.
class context:
def __init__(self, low, high):
self.low, self.high = low, high
def compare(self, x):
return self.low <= x < self.high
def my_filter(l, low, high):
return filter(context(low, high).compare, l)
Now you can write:
newlist = my_filter(oldlist, low_bound, high_bound)
An alternative is to construct and evaluate the call to filter at runtime:
def my_filter(l, low, high):
return eval('filter(lambda x: ' + str(low) + ' <= x < ' +
str(high) + ', l)')
-- Craig Lawson claw@rahul.net