Re: Default paranmeter for packed values

2010-04-19 Thread Terry Reedy
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 "

Re: Default paranmeter for packed values

2010-04-18 Thread Gregory Ewing
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

Re: Default paranmeter for packed values

2010-04-18 Thread alex23
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

Re: Default paranmeter for packed values

2010-04-18 Thread Xavier Ho
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

Re: Default paranmeter for packed values

2010-04-18 Thread Stephen Hansen
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)): > ^ >

Re: Default paranmeter for packed values

2010-04-18 Thread Chris Rebert
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

Re: Default paranmeter for packed values

2010-04-18 Thread MRAB
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

Default paranmeter for packed values

2010-04-18 Thread Xavier Ho
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)):