DEV Community

Discussion on: Difference between (*a) and (a)

Collapse
 
sfiquet profile image
Sylvie Fiquet

The * syntax is for passing a variable number of arguments. Since the function is called with a single argument, a is a list containing a single item: [[1,3,3]] so len(a) is 1.

Whereas in the second version a is [1,3,3] and len(a) is 3.

There's a good explanation of *args and **kwargs on saltycrane.com/blog/2008/01/how-to....

Collapse
 
piyush6299 profile image
Piyush Darji

Thanks a lot