Default paranmeter for packed values

Xavier Ho contact at xavierho.com
Sun Apr 18 19:23:38 EDT 2010


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?

Cheers,

Ching-Yun Xavier Ho, Technical Artist

Contact Information
Mobile: (+61) 04 3335 4748
Skype ID: SpaXe85
Email: contact at xavierho.com
Website: http://xavierho.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100419/64d66399/attachment.html>


More information about the Python-list mailing list