Can a class method have more than one argument named self?


#1

Question

Can a class method have more than one argument named self?

Answer

NO, having multiple arguments to a function with the same name will generate a SyntaxError: duplicate argument error in Python. This is true regardless of whether it is a standalone function or part of a class.


#2

self by definition denotes a singularity. Can we be more than ourself?

Every instance is a self when it becomes the context of a method. That is because instances are like the return value of a function factory.

Look at this carefully. Does a new instance not inherit methods? Is it not instantiated with unique instance variable values? That is what a function factory does. Except instead of instantiating objects it instantiates functions.

The thing in common with both is unique data given to their instance variables that can only be accessed on that instance. It is all scope related.