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


Groups > comp.lang.python > #56909

Re: how to add object from dict

From Ben Finney <ben+python@benfinney.id.au>
Subject Re: how to add object from dict
Date 2013-10-17 10:45 +1100
References <1381961694.21908.13.camel@debian>
Newsgroups comp.lang.python
Message-ID <mailman.1125.1381967149.18130.python-list@python.org> (permalink)

Show all headers | View raw


Mohsen Pahlevanzadeh <mohsen@pahlevanzadeh.org> writes:

> and another file,(projectsFind.py) i have the following code:
> #################################################################3
>         for key, val in
> self.projectsInstance.addOnFieldsInstance.items():
>             instance = getattr(self,"%s" % val)
>             print val
>             #QtCore.QObject.connect(instance,
> QtCore.SIGNAL(_fromUtf8("stateChanged (int)")),
>                                 #lambda:
> self.projectsInstance.setFilterDict_Find("TWCH",self,"addonfields",instance.CheckState(),instance))
> ######################################################################3

The above code has been mangled, and the indentation isn't correct. I
don't want to guess what it was originally; better that you find a user
agent which won't wrap your code lines.

The code is also difficult to read because it's got a lot of
camelCaseNames and it's hard to see what the intent is. (I'd advise
improving the code to conform to PEP 8, which will make your code easier
to discuss with the Python community.)

Lastly, it's not complete: we can't run it to see what you're seeing.

Please re-work (or create) a short, self-contained, complete example
that shows the behaviour <URL:http://sscce.org/>.

-- 
 \     “Wrinkles should merely indicate where smiles have been.” —Mark |
  `\                                    Twain, _Following the Equator_ |
_o__)                                                                  |
Ben Finney

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


Thread

Re: how to add object from dict Ben Finney <ben+python@benfinney.id.au> - 2013-10-17 10:45 +1100

csiph-web