On Wed, 2009-03-18 at 16:58 -0700, Mike314 wrote: > 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?
You could have verified this simply by getting rid of the function altogether: >>> type(('val1')) --> <type 'str'> Hint 1: >>> type((6)) --> <type 'int'> Hint 2: It's not the parentheses that define a tuple, it's the comma(s) >>> x = 'val1', >>> type(x) --> <type 'tuple'> -- http://mail.python.org/mailman/listinfo/python-list