argument type

It's me itsme at yahoo.com
Mon Dec 27 22:11:19 EST 2004


A newbie question.

How can I tell from within a function whether a particular argument is a
sigular type, or a complex type?

For instance, in:

    def abc(arg1)

How do I know if arg1 is a single type (like a number), or a list?

In C++, you would do it with function overloading.  If arg1 is always simple
type, I wouldn't care what it is.  But what if I *do* need to know whether
arg1 is a list or not?

I hate to have to have 2 functions: 1 for simple types, and one for list
types and then do something like:

    abc_simple(1.0)
    abc_list([1.0,2.0])

Any help would be greatly appreciated.





More information about the Python-list mailing list