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


Groups > comp.lang.python > #57376

Re: functools and objective usage

Date 2013-10-23 19:12 +0100
From MRAB <python@mrabarnett.plus.com>
Subject Re: functools and objective usage
References <1382478989.4873.6.camel@debian> <7w8uxleyya.fsf@benfinney.id.au> <5267109D.5040803@mrabarnett.plus.com> <1382546927.4873.13.camel@debian>
Newsgroups comp.lang.python
Message-ID <mailman.1418.1382551943.18130.python-list@python.org> (permalink)

Show all headers | View raw


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.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: functools and objective usage MRAB <python@mrabarnett.plus.com> - 2013-10-23 19:12 +0100

csiph-web