>> Do you have commit access? What's your real name?<br>I prefer to remain pseudonymous, and I don't have commit access.<br><br>Yeah... they're not terribly useful - more or less there for the sake of being there. Batteries included and all that
<br>
<br>
<br>
...but now I've got a more useful idea for a function wrapper
around predicate functions to make them a little more functionally inclined. Something like.......<br>
<br>
@predicate<br>def hasnext(x): return hasattr(x, "next")<br>
<br>
@predicate<br>
def hasiter(x): return hasattr(x, "__iter__")<br>
<br>
isiterable = hasnext or hasiter #or/and/not operators construct new predicate functions<br>
<br>
isEmptyIterable = isiterable and not predicate(bool)<br>
<br>
isgenerator = isiterable and (lambda x: hasattr(x, "send") and hasattr(x, "throw"))<br>
<br>
filter(isgenerator or callable, SomeSequence)<br>
<br>-- <br>"What's money? A man is a success if he gets up in the morning and goes to bed at night and in between does what he wants to do." ~ Bob Dylan