[Baypiggies] Newbie-ish type questions...

Charles Merriam charles.merriam at gmail.com
Wed Apr 23 08:01:48 CEST 2008


Hello,

I've been creating a growing number of type functions of the form:

def is_list(l):
    return type(l) is list

def is_string(s):
    return isinstance(s, basestring)

def is_iter(i):
    return hasattr(i, "next") and hasattr(i, "__iter__")

...etc., etc.

I feel like I must of missed something when I learned Python.  Is
there a simple call I'm missing for
these?  Does this get better in 3.0?

Charles M.


More information about the Baypiggies mailing list