Default paranmeter for packed values
MRAB
python at mrabarnett.plus.com
Sun Apr 18 19:40:49 EDT 2010
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 "<input>", line 1
> def t(a, *b = (3, 4)):
> ^
> SyntaxError: invalid syntax
>
> What was the rationale behind this design?
>
Perhaps it was that no-one ever thought of doing that! :-)
More information about the Python-list
mailing list