Superfluous python parameters
Posted
by Leif Andersen
on Stack Overflow
See other posts from Stack Overflow
or by Leif Andersen
Published on 2010-03-23T20:17:17Z
Indexed on
2010/03/23
20:23 UTC
Read the original article
Hit count: 536
I've noticed a discrepancy in the way that python parameters are called. In every other language I've dealt with, you either have
foo()
meaning either no parameters, or as many parameters as you like, or
foo(arg1, arg2,...,argn)
where you pass in the same number of parameters to define the function and call it. In python however, I've noticed that the function definitions, and when the function is called, can have two different parameters sets, this usually consists of:
class foo(object):
def bar(self, arg1, arg2):
pass
However, when I want to call the function, all I have to do is:
zoo = foo()
zoo.bar(arg1, arg2)
Where did the self parameter go?
Thank you.
© Stack Overflow or respective owner