Donn, That would lead to program error easily because when one forgets to include the needed [], you get unintended result from the program.
I am going to try the "isinstance" approach mentioned by Brian. Thanks, "Donn Cave" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Quoth "It's me" <[EMAIL PROTECTED]>: > | 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. > > How about abc([1.0])? That's easy, and it's a lot cleaner than > mucking up your API with functions whose parameters have multiple > possible interpretations. C++ doesn't always point the way to > great programming models. > > Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list