Reasoning behind 'self' parameter in classes?

John Nagle nagle at animats.com
Wed Jul 30 14:20:15 EDT 2008


Matthew Fitzgibbons wrote:
> Robert Dailey wrote:
>> I've always been curious (more so than annoyed) as to why one must 
>> explicitly specify a "self" parameter for member functions in a class 
>> in Python. This seems very "C" like to me, since to do object oriented 
>> programming in C you must devote one parameter to the object itself. 
>> In a higher order language like Python, I would not have expected (and 
>> thus am rather surprised) that this pattern would apply. Is there any 
>> particular reason why 'self' parameters must be specified explicitly? 
>> I am curious to understand the philosophy and design behind this.

     Think about the implications of a language without real declarations
and it will come to you.

				John Nagle
				Animats



More information about the Python-list mailing list