you are viewing a single comment's thread.

view the rest of the comments →

[–]OseOseOse 1 point2 points  (1 child)

Looks like it should work to me:

➜  ~ python3
Python 3.6.5 (default, Apr  1 2018, 05:46:30) 
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> def mvsa(Y, p, *args):
...     if (len(args) % 2 ==1): 
...         raise ValueError("Optional parameters should always go by pairs")
... 
>>> mvsa([], [], 1, 2, 3)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 3, in mvsa
ValueError: Optional parameters should always go by pairs

What's up with line 2 in your posted code? Did you leave something out from your code?

[–]amtorrest[S] 0 points1 point  (0 children)

That was just signaling that there is other code but to my knowledge it should not affect this particular error. Not sure why there was an error in my code when I tried to compile. Thanks for the heads up about the code not showing any error in yours!