Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #57377 > unrolled thread
| Started by | Mohsen Pahlevanzadeh <mohsen@pahlevanzadeh.org> |
|---|---|
| First post | 2013-10-23 21:56 +0330 |
| Last post | 2013-10-23 21:56 +0330 |
| 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.
Re: functools and objective usage Mohsen Pahlevanzadeh <mohsen@pahlevanzadeh.org> - 2013-10-23 21:56 +0330
| From | Mohsen Pahlevanzadeh <mohsen@pahlevanzadeh.org> |
|---|---|
| Date | 2013-10-23 21:56 +0330 |
| Subject | Re: functools and objective usage |
| Message-ID | <mailman.1419.1382552827.18130.python-list@python.org> |
Oh , i changed my code to: partial(self.myinstance.myfunc,[arg1,arg2,arg3,arg4,arg5],self.myinstance) But i got the following traceback: TypeError: myfunc() takes at least 5 arguments (4 given) ##############################3 myfunc() prototype is: ######################### def myfunc(self,widget,projectFindInstance,field,data,checkBox = None,lineEdit = None) ###################################### Note: My caller location in a class and myfunc is a method. How can i use partial for this state? Yours, Mohsen > On Wed, 2013-10-23 at 19:12 +0100, MRAB wrote:h > > Dear all, > > > > I have the following code in each steps of loop: > > #################################################### > > obj = partial(self.myinstance.myfunc) > > obj.func = self.myinstance.myfunc > > obj.arg = ["TWCH",self,key,val.checkState(),val] > > obj.keywords = self.myinstance > > ######################################################## > > But i get the following traceback: > > ############################################ > > Traceback (most recent call last): > > File "./main.py", line 117, in <module> > > main() > > File "./main.py", line 104, in main > > x.showFindProjects() > > File "/home/mohsen/codes/amlak/amlak/src/UIInterface.py", line 101, in > > showFindProjects > > self.uiProjectsFind.setupUi(self.projectsFind) > > File "/home/mohsen/codes/amlak/amlak/src/projectsFind.py", line 288, > > in setupUi > > obj.func = self.myinstance.myfunc > > TypeError: readonly attribute > > ############################################################### > > Before any help, Thank you... > > > What are you trying to do? > > Why are you trying to change obj.func? > > That attribute was set when you created the partial function, and the > other arguments should be provided at the same time. >
Back to top | Article view | comp.lang.python
csiph-web