[Python-Dev] Clean way in python to test for None, empty, scalar, and list/ndarray? A prayer to the gods of Python

Terry Reedy tjreedy at udel.edu
Sat Jun 15 22:11:59 CEST 2013

On 6/15/2013 8:53 AM, Tres Seaver wrote:

> In fifteen years of Python programming, I have literally *never* wanted
> to iterate over 'str' (or now 'bytes').

If so, it is because you have always been able to use pre-written 
methods and functions that internally do the iteration for you.

 > I've always considered the fact
> that Python made them iterable by default (rather than e.g. defining a
> method / property to get to an iterable "view" on the underlying string)

.__iter__ is that method.

But this is off-topic for pydev.

Terry Jan Reedy

More information about the Python-Dev mailing list