Mike314 wrote: (paraphrased)
>>> test_func(val=('val1'))
>>> test_func(val=('val1', 'val2'))
The output is quite different. Why I have string in the first case?
More natural English: "Why do I get string in the first case?"
(X) is the same as X (parentheses are for grouping), to get
a singl
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:
>
>
>
>
> Why I have string in the first case?
Because in Python the syntactic element that
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:
Why I have string in the first case?
Because () == .
Perhaps you meant ('val1',).
"Parenthesized forms
A parent
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:
>
>
>
>
> Why I have string in the first case?
You could h
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:
Why I have string in the first case?
It's the comma that makes the tuple, except for one special case: the
empty
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:
Why I have string in the first case?
Thanks.
--
http://mail.python.org/mailman/listinfo/python-list