The need to put "self" in every method

John Machin sjmachin at lexicon.net
Tue May 31 18:45:08 EDT 2005


Simon Brunning wrote:
> On 31 May 2005 08:45:45 -0700, Fernando M.
> <fernandomirandamuro at gmail.com> wrote:
> 
>>i was just wondering about the need to put "self" as the first
>>parameter in every method a class has because, if it's always needed,
>>why the obligation to write it?
> 
> 
> It doesn't need to be 'self'. You could use 'this', or 's', or whatever.
> 
> Of course, if you *don't* use 'self', you should expect an angly mob
> with pitchforks and torches outside your castle.
> 

Wouldn't an angly mob be carrying fishing rods?





More information about the Python-list mailing list