[Python-ideas] having a "iterable" built-in

Tarek Ziadé ziade.tarek at gmail.com
Wed Apr 29 20:47:45 CEST 2009


Hello

unless I missed it, I couldn't find a built-in to check if an object
is iterable,

so I wrote this function :

def iterable(ob):
    try:
        iter(ob)
    except TypeError:
        return False
    return True


What about having such a built-in in Python ? (with the proper
implementation if course)

Regards
Tarek

-- 
Tarek Ziadé | http://ziade.org



More information about the Python-ideas mailing list