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


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

Re: functools and objective usage

Started byMRAB <python@mrabarnett.plus.com>
First post2013-10-23 19:12 +0100
Last post2013-10-23 19:12 +0100
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: functools and objective usage MRAB <python@mrabarnett.plus.com> - 2013-10-23 19:12 +0100

#57376 — Re: functools and objective usage

FromMRAB <python@mrabarnett.plus.com>
Date2013-10-23 19:12 +0100
SubjectRe: functools and objective usage
Message-ID<mailman.1418.1382551943.18130.python-list@python.org>
On 23/10/2013 17:48, Mohsen Pahlevanzadeh wrote:
> 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.

[toc] | [standalone]


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


csiph-web