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


Groups > comp.lang.python > #56984

Re: how to add object from dict

Path csiph.com!usenet.pasdenom.info!news.etla.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <mohsen@pahlevanzadeh.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.011
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'read.': 0.03; 'advice.': 0.09; 'idea?': 0.09; 'pep': 0.09; 'recommends': 0.09; 'skip:# 30': 0.09; 'val': 0.09; 'cc:addr:python-list': 0.11; '(key,': 0.16; 'deprecated.': 0.16; 'finney': 0.16; 'for,': 0.16; 'lambda:': 0.16; 'skip:q 30': 0.16; 'subject:object': 0.16; 'wrote:': 0.18; 'discussion': 0.18; 'thu,': 0.19; 'cc:addr:python.org': 0.22; 'print': 0.22; 'example.': 0.24; 'fine': 0.24; 'regardless': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'right.': 0.26; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'related': 0.29; "doesn't": 0.30; 'code': 0.31; 'easier': 0.31; 'writes:': 0.31; 'style': 0.33; 'maybe': 0.34; 'subject:from': 0.34; 'but': 0.35; 'there': 0.35; 'chairman': 0.36; 'like,': 0.36; "i'll": 0.36; 'url:org': 0.36; 'ben': 0.38; 'according': 0.40; 'read': 0.60; 'forum': 0.61; "you're": 0.61; 'you.': 0.62; 'complete': 0.62; 'such': 0.63; 'world': 0.66; 'market': 0.66; 'saw': 0.77; '\xe2\x80\x93': 0.77; 'ibm,': 0.84; 'short,': 0.84; 'skip:s 80': 0.84; 'subject:add': 0.91
DKIM-Signature v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=pahlevanzadeh.org; s=default; h=Content-Transfer-Encoding:Mime-Version:Content-Type:References:In-Reply-To:Date:Cc:To:From:Subject:Message-ID; bh=To7/EtKbdzVSkfnVp0D8bbfMPgUtKgPn2oY/kkVx32o=; b=fmxhjJcPafw5p9QHDwuappQb+Cc2UR9UuZcL0QgFo8o9XitbIjP2SPxvtGZ5zlsRBSz8gLJpwyjqAsxubudLBeiwC5BiMvtiMJ9W8AbWTv9Ej5H0zp+5Gpa28uuHjjBbdz1yUGzAEdhk16QA5Sp29gqcgcnmttDlK3wG6bNPWJo=;
Subject Re: how to add object from dict
From Mohsen Pahlevanzadeh <mohsen@pahlevanzadeh.org>
To Ben Finney <ben+python@benfinney.id.au>
Date Thu, 17 Oct 2013 23:24:07 +0330
In-Reply-To <7wk3hciuul.fsf@benfinney.id.au>
References <1381961694.21908.13.camel@debian> <7wwqlcixup.fsf@benfinney.id.au> <1381968532.12853.4.camel@debian> <7wob6oiwgw.fsf@benfinney.id.au> <1381970241.12853.9.camel@debian> <7wk3hciuul.fsf@benfinney.id.au>
Content-Type text/plain; charset="UTF-8"
X-Mailer Evolution 3.8.5-2
Mime-Version 1.0
Content-Transfer-Encoding 8bit
X-AntiAbuse This header was added to track abuse, please include it with any abuse report
X-AntiAbuse Primary Hostname - part7.royal-servers.com
X-AntiAbuse Original Domain - python.org
X-AntiAbuse Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse Sender Address Domain - pahlevanzadeh.org
X-Get-Message-Sender-Via part7.royal-servers.com: authenticated_id: mohsen@pahlevanzadeh.org
Cc python-list@python.org
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.1174.1382039669.18130.python-list@python.org> (permalink)
Lines 51
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1382039669 news.xs4all.nl 15894 [2001:888:2000:d::a6]:52621
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:56984

Show key headers only | View raw


I sovled with :
################################
        for key, val in
self.projectsInstance.addOnFieldsInstance.items():
            setattr(self,"%s" % val,val)
            instance = getattr(self,"%s" % val)
            print "%s %s " % (key,val)
            QtCore.QObject.connect(instance,
QtCore.SIGNAL(_fromUtf8("stateChanged (int)")), lambda:
self.projectsInstance.setFilterDict_Find("TWCH",self,key,instance.checkState(),instance))
##########################################
In above loop i have probelm : instead of call connect function
according to number of my for, my connect function initilize and call
according to last (key, val),

Do you have any idea?

--mohsen
On Thu, 2013-10-17 at 11:50 +1100, Ben Finney wrote:
> Mohsen Pahlevanzadeh <mohsen@pahlevanzadeh.org> writes:
> 
> > You say right, but i don't any time to read all of content of
> > http://sscce.org/ , But when i saw its description , i found out ,
> > it's a set of law for good answer/question
> 
> That's right. Please take the time to help us to help you, by following
> that advice.
> 
> > Also i saw PEP 8 , it's like old style C, and i like CamelCase.
> 
> TitleCaseNames are fine (PEP 8 recommends TitleCaseNames for classes),
> camelCase is inconsistent and hence deprecated.
> 
> Regardless of what you like, if you're presenting code for others to
> read – such as in a discussion forum where you'd like others to read
> your code and help you – you are well advised to follow PEP 8 so your
> code is easier for us to read.
> 
> > But now, all of my code doesn't work and related to the given
> > traceback of i sent you.
> 
> I'll wait for your short, self-contained, complete example.
> 
> -- 
>  \         “I think there is a world market for maybe five computers.” |
>   `\                             —Thomas Watson, chairman of IBM, 1943 |
> _o__)                                                                  |
> Ben Finney
> 

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


Thread

Re: how to add object from dict Mohsen Pahlevanzadeh <mohsen@pahlevanzadeh.org> - 2013-10-17 23:24 +0330

csiph-web