Re: [Tutor] function argument unpacking

2016-12-08 Thread Danny Yoo
On Thu, Dec 8, 2016 at 1:11 AM, Alan Gauld via Tutor wrote: > On 08/12/16 06:04, Palanikumar wrote: >> #Function Argument unpacking >> def myfunc(x, y, z): >> print(x. v. z) >> > > Please always send the actual code that generates > the error, do not retype as it causes us to chase > phantom

Re: [Tutor] function argument unpacking

2016-12-08 Thread Alan Gauld via Tutor
On 08/12/16 06:04, Palanikumar wrote: > #Function Argument unpacking > def myfunc(x, y, z): > print(x. v. z) > Please always send the actual code that generates the error, do not retype as it causes us to chase phantom bugs. In this case the fact that the v in the print statement should be a

Re: [Tutor] function argument unpacking

2016-12-08 Thread Peter Otten
Palanikumar wrote: > File "func.py", line 8 > tuple_vec = {1, 0, 1) > ^ > SyntaxError: invalid syntax The opening and the closing parenthesis have to match. To get a tuple: tuple_vec = (1, 0, 1) To get a set (with two values in undefined order, so not a good match

[Tutor] function argument unpacking

2016-12-08 Thread Palanikumar
#Function Argument unpacking def myfunc(x, y, z): print(x. v. z) tuple_vec = {1, 0, 1) dict_vec = {'x':1, 'y':0, 'z':1} myfunc(*tuple_vec) myfunc(*dict_vec) It returns following error File "func.py", line 8 tuple_vec = {1, 0, 1) ^ SyntaxError: invalid syntax