On 4/18/2010 7:23 PM, Xavier Ho wrote:
G'day Pythoneers,
I ran into a strange problem today: why does Python not allow default
paranmeters for packed arguments in a function def?
>> def test(a = 1, b = (2, 3)):
... print a, b
...
>> test()
1 (2, 3)
>> def t(a, *b = (3, 4)):
File "
MRAB wrote:
Xavier Ho wrote:
>> def t(a, *b = (3, 4)):
File "", line 1
def t(a, *b = (3, 4)):
^
SyntaxError: invalid syntax
What was the rationale behind this design?
The concept of a default value for the * argument doesn't
really apply, because there is always a val
Xavier Ho wrote:
> I ran into a strange problem today: why does Python not allow default
> paranmeters for packed arguments in a function def?
>> >> def t(a, *b = (3, 4)):
> File "", line 1
> def t(a, *b = (3, 4)):
> ^
> SyntaxError: invalid syntax
> What was the rationale b
On Mon, Apr 19, 2010 at 9:46 AM, Chris Rebert wrote:
> It doesn't really make sense to use * in such situations anyway, you
> can just do the normal `z = (1,2,3)`
But calling function(1.0, (0.0, 1.0, 0.0)) has been a big pet peeve of mine,
and it looks extremely ugly and, imo, unpythonic.
On M
On Sun, Apr 18, 2010 at 4:23 PM, Xavier Ho wrote:
> G'day Pythoneers,
>
> I ran into a strange problem today: why does Python not allow default
> paranmeters for packed arguments in a function def?
> >>> def t(a, *b = (3, 4)):
> File "", line 1
> def t(a, *b = (3, 4)):
> ^
>
On Sun, Apr 18, 2010 at 4:23 PM, Xavier Ho wrote:
> I ran into a strange problem today: why does Python not allow default
> paranmeters for packed arguments in a function def?
>
def test(a = 1, b = (2, 3)):
> ... print a, b
> ...
test()
> 1 (2, 3)
>
def t(a, *b = (3, 4)):
> Fi
Xavier Ho wrote:
G'day Pythoneers,
I ran into a strange problem today: why does Python not allow default
paranmeters for packed arguments in a function def?
>> def test(a = 1, b = (2, 3)):
... print a, b
...
>> test()
1 (2, 3)
>> def t(a, *b = (3, 4)):
File "", line 1
def
G'day Pythoneers,
I ran into a strange problem today: why does Python not allow default
paranmeters for packed arguments in a function def?
>>> def test(a = 1, b = (2, 3)):
... print a, b
...
>>> test()
1 (2, 3)
>>> def t(a, *b = (3, 4)):
File "", line 1
def t(a, *b = (3, 4)):