Re: Use empty string for self

2006-03-01 Thread John Salerno
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

Re: Use empty string for self

2006-03-01 Thread Duncan Booth
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

Re: Use empty string for self

2006-03-01 Thread Douglas Alan
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

Re: Use empty string for self

2006-03-01 Thread John Salerno
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 >

Re: Use empty string for self

2006-03-01 Thread Grant Edwards
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

Re: Use empty string for self

2006-03-01 Thread Roy Smith
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

Re: Use empty string for self

2006-03-01 Thread John Salerno
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

Re: Use empty string for self

2006-02-28 Thread James Stroud
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

Re: Use empty string for self

2006-02-28 Thread John Salerno
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

Re: Use empty string for self

2006-02-28 Thread Grant Edwards
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

Re: Use empty string for self

2006-02-28 Thread John Salerno
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

Re: Use empty string for self

2006-02-28 Thread Roy Smith
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

Re: Use empty string for self

2006-02-28 Thread Terry Hancock
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

Re: Use empty string for self

2006-02-28 Thread Roy Smith
[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

Re: Use empty string for self

2006-02-28 Thread paullanier
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

Re: Use empty string for self

2006-02-28 Thread Peter Hansen
[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):