isiter builtin

2014-11-16 Thread Garrett Berg
I have been working with python for a few years now, and two of my favorite features about it are iterators and duck typing. The fact that every iterator under the sun can be accessed with a simple for loop is one of the most amazing features of python. However, there are times when I want to do

Re: isiter builtin

2014-11-16 Thread Chris Angelico
On Sun, Nov 16, 2014 at 6:57 PM, Garrett Berg googb...@gmail.com wrote: However, there are times when I want to do type checking, and the builtin function isinstance is of great use. However, this function fails to be satisfactory in returning whether the object is a valid iterator. The call

Re: isiter builtin

2014-11-16 Thread Ben Finney
Garrett Berg googb...@gmail.com writes: However, there are times when I want to do type checking, and the builtin function *isinstance* is of great use. I would advise that when you think you want type checking, you are probably being overly restrictive. However, this function fails to be

Re: isiter builtin

2014-11-16 Thread Peter Otten
Garrett Berg wrote: I have been working with python for a few years now, and two of my favorite features about it are iterators and duck typing. The fact that every iterator under the sun can be accessed with a simple for loop is one of the most amazing features of python. However, there

Re: isiter builtin

2014-11-16 Thread Terry Reedy
On 11/16/2014 2:57 AM, Garrett Berg wrote: (how often have you iterated over a string?) Often enough, but perhaps more often have written functions for which a string is as valid an input as many other iterables. def cross(iterable, reiterable): for a in iterable: for b in