Duncan Booth wrote:
> John Salerno wrote:
>
>>> The two calls are equivalent.
>> can you also say instance.mymethod(instance, 1, 2) ?
>
> Only if mymethod is defined to take all 4 arguments you just passed to it.
Got it. I understand how it works now.
--
http://mail.python.org/mailman/listin
John Salerno wrote:
>> The two calls are equivalent.
>
> can you also say instance.mymethod(instance, 1, 2) ?
Only if mymethod is defined to take all 4 arguments you just passed to it.
--
http://mail.python.org/mailman/listinfo/python-list
Roy Smith <[EMAIL PROTECTED]> writes:
> Terry Hancock <[EMAIL PROTECTED]> wrote:
>> However, there is a slightly less onerous method which
>> is perfectly legit in present Python -- just use "s"
>> for "self":
> This is being different for the sake of being different. Everybody *knows*
> what
Grant Edwards wrote:
> But it _is_ always passed to the function. You can even pass
> it explicity when you call the method if you want:
I meant it isn't always explicitly passed.
>
> #!/usr/bin/python
>
> class MyClass:
> def mymethod(self,p1,p2):
> print self,p1,p2
>
On 2006-03-01, John Salerno <[EMAIL PROTECTED]> wrote:
> I do get it. I think I will just have to get used to seeing
> the 'self' argument but understanding that it's not really
> something that is always passed in.
But it _is_ always passed to the function. You can even pass
it explicity when y
John Salerno <[EMAIL PROTECTED]> wrote:
>I do get it. I think I will just have to get used to seeing the 'self'
>argument but understanding that it's not really something that is always
>passed in. I'm trying to train myself to see
>
>def doittoit(self) as def doittoit()
That's OK as far as usi
James Stroud wrote:
> py> def doittoit(it):
> ... print it.whatzit
> ...
> py> class It:
> ... whatzit = 42
> ... def doittoit(self):
> ... print self.whatzit
> ...
> py> anit = It()
> py> doittoit(anit)
> 42
> py> It.doittoit(anit)
> 42
> py> anit.doittoit()
> 42
>
>
> If you get this
John Salerno wrote:
> Grant Edwards wrote:
>
>>> A related thing I was wondering about was the use of 'self' in
>>> class methods as the first parameter.
>>
>>
>> It's not a related thing, it's the same thing.
>
>
> Oh sorry. I thought the OP was asking about having to use self when
> qualifyin
Grant Edwards wrote:
>> A related thing I was wondering about was the use of 'self' in
>> class methods as the first parameter.
>
> It's not a related thing, it's the same thing.
Oh sorry. I thought the OP was asking about having to use self when
qualifying attributes, or even if he was, I didn
On 2006-03-01, John Salerno <[EMAIL PROTECTED]> wrote:
>> Yes. To death. Executive summary: self is here to stay.
>
> A related thing I was wondering about was the use of 'self' in
> class methods as the first parameter.
It's not a related thing, it's the same thing.
> I understand that right
Roy Smith wrote:
> [EMAIL PROTECTED] wrote:
>> Any comments? Has this been discussed before?
>
> Yes. To death. Executive summary: self is here to stay.
A related thing I was wondering about was the use of 'self' in class
methods as the first parameter. I understand that right now it is
nece
Terry Hancock <[EMAIL PROTECTED]> wrote:
> However, there is a slightly less onerous method which
> is perfectly legit in present Python -- just use "s"
> for "self":
This is being different for the sake of being different. Everybody *knows*
what self means. If you write your code with s instea
On 28 Feb 2006 15:54:06 -0800
[EMAIL PROTECTED] wrote:
> The issue I have with self. is that is makes the code
> larger and more complicated than it needs to be.
> Especially in math expressions like: self.position[0] =
> self.startx + len(self.bitlist) * self.bitwidth
>
> It really makes the cod
[EMAIL PROTECTED] wrote:
> Any comments? Has this been discussed before?
Yes. To death. Executive summary: self is here to stay.
--
http://mail.python.org/mailman/listinfo/python-list
Thanks. I thought for sure it must have been discussed before but for
whatever reason, my googling skills couldn't locate it.
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
> It seems that lots of people don't like having to prefix self. in front
...
> But what if we keep the '.' and leave out the self.
...
> Any comments? Has this been discussed before?
Yes, at least once (found by group-googling for "removing self" in this
newsgroup):
16 matches
Mail list logo