[Tutor] function argument unpacking

Danny Yoo dyoo at hashcollision.org
Thu Dec 8 12:43:03 EST 2016


On Thu, Dec 8, 2016 at 1:11 AM, Alan Gauld via Tutor <tutor at python.org> 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 bugs. In this case the fact that the v
> in the print statement should be a y and that
> you are using periods as separators instead
> of commas...
>
>> File "func.py", line 8
>>      tuple_vec = {1, 0, 1)
>>                          ^
>> SyntaxError: invalid syntax
>
> Change the opening brace { to a parenthesis (


Hi Palanikumar,

Also, when you have time, see if you can use a text editor or IDE that
does "syntax highlighting".  You should be able to catch this kind of
error early on, during program entry, if the editing environment is
smart enough.  Most IDEs that are Python-aware will tell you, via
textual hints or coloring, when the parentheses, brackets or braces
have been mismatching.

See:  https://wiki.python.org/moin/IntegratedDevelopmentEnvironments
for a list of known text editors or IDEs that are Python-aware.  I
personally use Emacs, but I've heard very good things about other
environments like Vim, Sublime Text, and others.  You may want to ask
other peers about their recommendations.  A good editing environment
can be a valuable tool for programming.


More information about the Tutor mailing list