Tuple passed to function recognised as string

Mike314 michaelst at gmail.com
Thu Mar 19 00:58:12 CET 2009


Hello,

   I have following code:

def test_func(val):
    print type(val)

test_func(val=('val1'))
test_func(val=('val1', 'val2'))

The output is quite different:

<type 'str'>
<type 'tuple'>

Why I have string in the first case?

Thanks.



More information about the Python-list mailing list