Re: The need to put "self" in every method
- From: "John Roth" <newsgroups@xxxxxxxxxxxx>
- Date: Tue, 31 May 2005 10:19:14 -0600
"Fernando M." <fernandomirandamuro@xxxxxxxxx> wrote in message news:1117554344.938440.54700@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi,
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? couldn't it be implicit?
Or is it a special reason for this being this way?
There are two different issues.
1. If self was made a keyword, there would be no need for it in the method header. However, that would be a major incompabible change affecting almost every script in existance. Also some people use other words than self. (It would, by the way, result in a performance improvement.)
2. There's been some talk of making the '.' operator allow an implied instance. I'm not sure what the status of this is.
These two are actually separate issues; either could be done without the other.
John Roth
Thanks.
.
- References:
- The need to put "self" in every method
- From: Fernando M.
- The need to put "self" in every method
- Prev by Date: Re: how to convert string to list or tuple
- Next by Date: Re: How do you drive-by-wire a car using Python ?
- Previous by thread: Re: The need to put "self" in every method
- Next by thread: Re: The need to put "self" in every method
- Index(es):
Relevant Pages
|