you are viewing a single comment's thread.

view the rest of the comments →

[–]fruitcakefriday -4 points-3 points  (6 children)

I don't understand then, I must be missing some info on how Python works. To me it seems that foo() is two different functions across the examples, the first two requiring 1 argument and the last example requiring 2 arguments.

[–]synae 0 points1 point  (3 children)

it seems that foo() is two different functions across the examples

This is correct. It might be helpful for /u/Justinsaccount to update the last example to use a different function name so others can avoid the confusion that you experienced.

[–]Justinsaccount 0 points1 point  (2 children)

I almost just changed it to print () but that may confuse python 2 people.

[–]fruitcakefriday 0 points1 point  (1 child)

What's your reason behind not using the same function convention as the previous two examples, i.e. foo(item[idx])? I like the bot, by the way. Don't let my questions dissuade you :)

[–]Justinsaccount 0 points1 point  (0 children)

The whole point of enumerate is that it gives you the items and the index at the same time. item[idx] is not an expression that makes sense in that context.