Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed5.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.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; '(although': 0.05; 'exec': 0.07; 'hettinger': 0.07; 'python': 0.08; '(it': 0.09; '>>>>': 0.09; 'bug,': 0.09; 'figuring': 0.09; 'readable': 0.09; 'reason?': 0.09; 'developer': 0.12; 'cc:addr:python-list': 0.15; '"real"': 0.16; '8:26': 0.16; 'code).': 0.16; 'different,': 0.16; 'input.': 0.16; 'obvious.': 0.16; 'received:209.85.210.42': 0.16; 'received :mail-pz0-f42.google.com': 0.16; 'subject:() ': 0.16; 'to:addr:pearwood.info': 0.16; 'to:addr:steve+comp.lang.python': 0.16; "to:name:steven d'aprano": 0.16; 'wed,': 0.17; 'language': 0.17; 'wrote:': 0.18; '>>>': 0.18; 'alternate': 0.18; 'otherwise,': 0.19; 'seems': 0.19; 'figure': 0.20; 'cc:no real name:2**0': 0.21; 'pointed': 0.21; 'raymond': 0.21; 'so.': 0.21; 'obviously': 0.23; '"it\'s': 0.23; 'fine,': 0.23; 'name?': 0.23; 'header:In-Reply-To:1': 0.23; 'cc:2**0': 0.25; 'statement': 0.25; 'saying': 0.25; 'fine': 0.26; "i'm": 0.26; 'code,': 0.27; 'somebody': 0.27; 'url:mailman': 0.27; 'fine.': 0.28; 'cc:addr:python.org': 0.29; 'message-id:@mail.gmail.com': 0.29; 'senior': 0.29; 'module': 0.30; 'happen?': 0.30; 'subject:?': 0.31; 'nov': 0.31; 'pm,': 0.31; 'actual': 0.32; 'url:listinfo': 0.32; 'does': 0.32; "can't": 0.32; 'it.': 0.33; 'someone': 0.33; 'there': 0.33; 'approach.': 0.34; 'sense,': 0.34; 'things': 0.35; "what's": 0.35; 'modules': 0.35; 'certain': 0.35; 'url:python': 0.35; 'anything': 0.36; 'like,': 0.36; 'thread': 0.36; 'but': 0.37; 'issue': 0.37; 'think': 0.37; '(not': 0.37; 'using': 0.37; 'steven': 0.38; 'received:google.com': 0.38; 'some': 0.38; 'received:209.85': 0.38; 'url:org': 0.38; "i'd": 0.39; "it's": 0.39; 'why': 0.39; 'subject:: ': 0.39; 'received:209': 0.40; 'being': 0.40; 'really': 0.40; 'more': 0.60; 'double': 0.61; 'your': 0.61; 'results': 0.61; 'him,': 0.62; '2011': 0.62; 'full': 0.62; 'believe': 0.64; 'ever': 0.65; 'here.': 0.66; 'share': 0.66; 'respect': 0.66; 'doing.': 0.73; '-0500,': 0.84; 'cautious': 0.84; 'damaged': 0.84; 'macros,': 0.84; 'paranoia': 0.84; 'serious.': 0.84; 'troubles': 0.84; 'night,': 0.91; 'suspicious': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=sT8B14iGo3fTU+qXfBIafWpoKxSz4LglcZ6c1PavmXQ=; b=KYmOuXBDVkOLlmmbVM7GYsXYCfFjZz9S7buLo6g6KM6WHqtV/6EK6gkJA66IkP/zhK XNOZF61t/imDHXo0IqxjJJRwjmwIpS9jacCQpbsvVvzgM//leIrFNbDr6H30ptPEUVRh 2a06Zf4vAUHyJqFfn7a/lS+arcGpWVv+82/cY= MIME-Version: 1.0 In-Reply-To: References: <436fb6a3-1075-45a6-8f93-5612d050b11a@q35g2000prh.googlegroups.com> <4eb9e9c2$0$29988$c3e8da3$5496439d@news.astraweb.com> <4ebb08b6$0$29970$c3e8da3$5496439d@news.astraweb.com> From: Devin Jeanpierre Date: Wed, 9 Nov 2011 20:35:02 -0500 Subject: Re: all() is slow? To: "Steven D'Aprano" Content-Type: text/plain; charset=UTF-8 Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 83 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1320888952 news.xs4all.nl 6852 [2001:888:2000:d::a6]:39453 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:15521 > Well. It reads fine in a certain sense, in that I can figure out > what's going on (although I have some troubles figuring out why the > heck certain things are in the code). The issue is that what's going > on is otherworldly: this is not a Python pattern, this is not a normal > approach. To me, that means it does not read fine. Sorry for the double post, but I think I damaged my statement a little in the edit process here. I have a hard time reading the code, and the implications of using exec on how initialization works is not obvious. I do believe that this solution is significantly less readable than it would be in a language with "real" macros, or using an alternate dict-based approach. I don't mean to just say "it's different, therefore it's wrong" -- it takes more than just being unusual (not that the unusualness helps). Devin On Wed, Nov 9, 2011 at 8:26 PM, Devin Jeanpierre wrote: >> Neither am I. I am less suspicious based on a reputation. Raymond is a >> well-known, trusted senior Python developer who knows what he is doing. > > I don't really know anything about him or why people respect him, so I > have no reason to share your faith. > >> It reads fine, and the justification is perfectly valid. > > Well. It reads fine in a certain sense, in that I can figure out > what's going on (although I have some troubles figuring out why the > heck certain things are in the code). The issue is that what's going > on is otherworldly: this is not a Python pattern, this is not a normal > approach. To me, that means it does not read fine. > > The use of exec also results in (seemingly) arbitrary constraints on > the input. Like, why can't "--" be a name? Because exec? Is there some > other reason? > > I don't like the use of exec, and I don't like the justification (it > seems handwavy). I pointed this out in a thread full of people saying > "never EVER use exec this way", so it's obviously not just me that > thinks this is awful. > >> You're right to be cautious of exec. You're wrong to be phobic about it. >> What do you think is going to happen? > > I think somebody will read it and think this is a good idea. > > Devin > > > On Wed, Nov 9, 2011 at 6:11 PM, Steven D'Aprano > wrote: >> On Wed, 09 Nov 2011 18:01:16 -0500, Devin Jeanpierre wrote: >> >>>> If it were someone other than Raymond Hettinger responsible for the use >>>> of exec in namedtuple, I'd be a lot more suspicious of it. >>> >>> I'm not going to be less suspicious based on a name. >> >> Neither am I. I am less suspicious based on a reputation. Raymond is a >> well-known, trusted senior Python developer who knows what he is doing. >> >> >>> It reads like >>> insanity, and the justification was terrible. >> >> It reads fine, and the justification is perfectly valid. >> >> You're right to be cautious of exec. You're wrong to be phobic about it. >> What do you think is going to happen? The exec call inside namedtuple is >> going to creep out of the module in the wee hours of the night, >> contaminating other functions and modules while you sleep? Be serious. If >> you have an actual concrete security vulnerability caused by the use of >> exec inside namedtuple, or some other bug, then say so. Otherwise, your >> paranoia is unjustified. >> >> >> >> -- >> Steven >> -- >> http://mail.python.org/mailman/listinfo/python-list >> >