Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #55746 > unrolled thread

Re: multiple values for keyword argument

Started byFrank Dierkes <Frank.Dierkes@googlemail.com>
First post2011-01-29 13:43 +0000
Last post2011-01-29 13:43 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: multiple values for keyword argument Frank Dierkes <Frank.Dierkes@googlemail.com> - 2011-01-29 13:43 +0000

#55746 — Re: multiple values for keyword argument

FromFrank Dierkes <Frank.Dierkes@googlemail.com>
Date2011-01-29 13:43 +0000
SubjectRe: multiple values for keyword argument
Message-ID<8qijsgFgu1U1@mid.dfncis.de>
On Sat, 29 Jan 2011 14:18:30 +0100, Tobias Blass wrote:

> On Sat, 29 Jan 2011, Francesco Bochicchio wrote:
> 
>>> class MainWin(Frame):
>>>         def create_edit(row,self):

>>>         def create_edit(self, row):
>>

>>
>>
> Ok it works now. So the problem was that python requires 'self' to be
> the first parameter?

If you define an instance method, the first parameter is always the 
instance passed to the method - regardless of the parameters name.

In your case the instance was passed to the row parameter. Then again you 
wanted to pass i to it. That's why the exception was raised. If you just 
had typed self.create_edit(i), then row would have been the instance 
(*self*.create_edit(...)) and self would have been i.

Naming the first parameter self is only a convention. It could be any 
other name, too.

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web