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


Groups > comp.lang.python > #56909

Re: how to add object from dict

Path csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'correct.': 0.07; "(i'd": 0.09; 'lines.': 0.09; 'pep': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'skip:# 30': 0.09; 'skip:# 60': 0.09; 'val': 0.09; 'python': 0.11; 'create)': 0.16; 'finney': 0.16; 'merely': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'skip:q 30': 0.16; 'subject:object': 0.16; 'example': 0.22; 'print': 0.22; 'header :User-Agent:1': 0.23; '(or': 0.24; 'code:': 0.26; 'header:X -Complaints-To:1': 0.27; 'code': 0.31; 'easier': 0.31; 'indentation': 0.31; 'writes:': 0.31; 'run': 0.32; 'another': 0.32; 'guess': 0.33; 'subject:from': 0.34; "can't": 0.35; 'shows': 0.36; 'url:org': 0.36; 'should': 0.36; 'ben': 0.38; 'improving': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'read': 0.60; 'is.': 0.60; "you're": 0.61; 'discuss': 0.62; 'complete': 0.62; 'lastly,': 0.84; 'short,': 0.84; 'subject:add': 0.91
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Ben Finney <ben+python@benfinney.id.au>
Subject Re: how to add object from dict
Date Thu, 17 Oct 2013 10:45:34 +1100
References <1381961694.21908.13.camel@debian>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 8bit
X-Gmane-NNTP-Posting-Host rasputin.madmonks.org
X-Public-Key-ID 0xAC128405
X-Public-Key-Fingerprint 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405
X-Public-Key-URL http://www.benfinney.id.au/contact/bfinney-gpg.asc
X-Post-From Ben Finney <bignose+hates-spam@benfinney.id.au>
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux)
Cancel-Lock sha1:7/hXU5XEqXPyE03f3v7UQ47Fp+o=
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1125.1381967149.18130.python-list@python.org> (permalink)
Lines 34
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1381967149 news.xs4all.nl 15939 [2001:888:2000:d::a6]:47183
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:56909

Show key headers only | 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