Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!news2.arglkargh.de!news.albasani.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.030 X-Spam-Evidence: '*H*': 0.94; '*S*': 0.00; 'appropriate.': 0.09; 'lookup': 0.09; 'dictionary.': 0.16; 'from:addr:torriem': 0.16; 'from:name:michael torrie': 0.16; 'morning,': 0.16; 'subject:slow': 0.16; 'appropriate': 0.16; 'wrote:': 0.18; 'header :User-Agent:1': 0.23; "aren't": 0.24; 'task': 0.26; 'header:In- Reply-To:1': 0.27; 'function': 0.29; 'array': 0.29; 'probably': 0.32; 'wrong': 0.37; 'list': 0.37; 'message-id:@gmail.com': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'structure': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; "you're": 0.61; 'more': 0.64; 'directly.': 0.95 X-Virus-Scanned: amavisd-new at torriefamily.org Date: Tue, 09 Sep 2014 09:34:46 -0600 From: Michael Torrie User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20131118 Thunderbird/17.0.11 MIME-Version: 1.0 To: python-list@python.org Subject: Re: weakref, memory management and execution slow down in PyQt4 References: <540BFE43.5030006@riseup.net> <540CADDD.3050501@riseup.net> <540CB15C.2060008@gmail.com> <540CC278.4050106@riseup.net> <540E40FD.8030706@gmail.com> <540E69AF.5040309@riseup.net> In-Reply-To: <540E69AF.5040309@riseup.net> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 12 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1410276906 news.xs4all.nl 2936 [2001:888:2000:d::a6]:41164 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:77741 On 09/08/2014 08:45 PM, kjs wrote: > You're right, a dictionary can do everything I need and more. Actually I am wrong in suggesting a dictionary. A list or an array would probably be more appropriate. Thinking about it this morning, one additional reason why getattr and setattr aren't appropriate for this task is that they are not just a dictionary lookup under the hood, they are an additional layer. One more function call that would be unnecessary if you used a data structure directly.