On Mon, Aug 29, 2011 at 7:20 AM, Travis Parks <jehugalea...@gmail.com> wrote: > > if source is None: raise ValueError("") > if not isinstanceof(source, collections.iterable): raise TypeError("") > if not callable(predicate): raise TypeError("") >
Easier: Just ignore the possibilities of failure and carry on with your code. If the source isn't iterable, you'll get an error raised by the for loop. If the predicate's not callable, you'll get an error raised when you try to call it. The only consideration you might need to deal with is that the predicate's not callable, and only if you're worried that consuming something from your source would be a problem (which it won't be with the normal iterables - strings, lists, etc, etc). Otherwise, just let the exceptions be raised! ChrisA -- http://mail.python.org/mailman/listinfo/python-list