parameter list notation

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Tue Sep 4 16:53:06 EDT 2007


On Mon, 03 Sep 2007 22:10:41 -0700, TheFlyingDutchman wrote:

> Well I did a search on "Python variable length arguments" and found a
> hit that seems to explain the *fields parameter:
> 
> When you declare an argment to start with '*', it takes the argument
> list into an array.

No it doesn't. 

>>> def test(*args):
...     import array
...     assert type(args) is array.array, "Not an array"
...
>>> test(1, 2, 3)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 3, in test
AssertionError: Not an array




-- 
Steven.



More information about the Python-list mailing list