Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #15559
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!tudelft.nl!txtfeed1.tudelft.nl!newsfeed20.multikabel.net!multikabel.net!newsfeed10.multikabel.net!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <jeanpierreda@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; '(although': 0.05; 'attribute': 0.07; 'exec': 0.07; 'python': 0.08; 'dynamically': 0.09; 'figuring': 0.09; 'identifier,': 0.09; 'readable': 0.09; 'reason?': 0.09; '~ethan~': 0.09; 'argument': 0.15; 'cc:addr :python-list': 0.15; 'code).': 0.16; 'identifiers': 0.16; 'input.': 0.16; 'objects).': 0.16; 'subject:() ': 0.16; 'wrote:': 0.18; 'reason,': 0.18; 'figure': 0.20; 'later': 0.21; 'cc:no real name:2**0': 0.21; 'primarily': 0.21; 'name?': 0.23; 'header:In- Reply-To:1': 0.23; 'string': 0.23; 'do,': 0.24; 'cc:2**0': 0.25; 'code': 0.25; 'code.': 0.26; 'fine': 0.26; 'function': 0.27; 'somebody': 0.27; 'not.': 0.27; 'url:mailman': 0.27; 'invalid': 0.28; 'fine.': 0.28; 'cc:addr:python.org': 0.29; 'message- id:@mail.gmail.com': 0.29; 'pasted': 0.30; 'pattern': 0.30; 'really,': 0.30; '(e.g.': 0.30; 'subject:?': 0.31; 'nov': 0.31; 'pm,': 0.31; 'certainly': 0.32; 'thu,': 0.32; 'url:listinfo': 0.32; 'does': 0.32; "can't": 0.32; 'that,': 0.33; 'there': 0.33; 'on,': 0.33; 'setting': 0.34; 'approach.': 0.34; 'sense,': 0.34; 'however,': 0.34; 'things': 0.35; "what's": 0.35; 'object': 0.35; 'certain': 0.35; 'url:python': 0.35; 'like,': 0.36; 'limitation': 0.36; 'passed': 0.37; 'issue': 0.37; 'think': 0.37; '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; 'supports': 0.40; 'really': 0.40; 'more': 0.60; 'your': 0.61; 'results': 0.61; '2011': 0.62; 'projects': 0.62; 'virtually': 0.73; '"nothing"': 0.84; 'troubles': 0.84 |
| 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:content-transfer-encoding; bh=oBEWnx99CePB2isGXiM7CiirBOE3fIffDgidNaCQuv8=; b=ijnXVUdCDmzcYmSOhvcOX1H8mKRX8kbP7WHgsfr+QnCh0pbu9EbVi9gxGSppr8KUNp upAN/I7f8hhAKgtye3oATEUacneQ4tyOwk6tt00llf+ZhxyFTq3wf2bonE5DPTbjNC86 rKuwRY06D55CKsq4b9nzSTYWyB4rdv5EdeIxg= |
| MIME-Version | 1.0 |
| In-Reply-To | <4EBC1B54.6000308@stoneleaf.us> |
| References | <Xns9F9684761E3AOKB@88.198.244.100> <436fb6a3-1075-45a6-8f93-5612d050b11a@q35g2000prh.googlegroups.com> <CAPTjJmqESQc2HrMNSKLbnG5C8fvrOQvaPme0vTN9VS9eQkndFg@mail.gmail.com> <mailman.2558.1320799508.27778.python-list@python.org> <4eb9e9c2$0$29988$c3e8da3$5496439d@news.astraweb.com> <mailman.2577.1320879720.27778.python-list@python.org> <4ebb08b6$0$29970$c3e8da3$5496439d@news.astraweb.com> <CABicbJ+KkQ8Of4a84TM5nN+ZSh-TBioboLZ9VX1JNzw8G2bToQ@mail.gmail.com> <4EBC1B54.6000308@stoneleaf.us> |
| From | Devin Jeanpierre <jeanpierreda@gmail.com> |
| Date | Thu, 10 Nov 2011 15:37:05 -0500 |
| Subject | Re: all() is slow? |
| To | Ethan Furman <ethan@stoneleaf.us> |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | quoted-printable |
| 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 <python-list.python.org> |
| List-Unsubscribe | <http://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 | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2621.1320957468.27778.python-list@python.org> (permalink) |
| Lines | 62 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1320957468 news.xs4all.nl 6913 [2001:888:2000:d::a6]:53613 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:15559 |
Show key headers only | View raw
> '--' not being allowed for a name has *nothing* to do with exec, and > everything to do with `--` not being a valid Python identifier. The only reason valid python identifiers come into it at all is because they get pasted into a string where identifiers would go, and that string is passed to exec(). So really, does it have "nothing" to do with exec? Or does your argument eventually boil down to the use of exec? > is more readable than Of course not. I do, however, think that it's conceivable that I'd want to key a namedtuple by an invalid identifier, and to do that, yes, I'd need to use getattr(). Devin On Thu, Nov 10, 2011 at 1:43 PM, Ethan Furman <ethan@stoneleaf.us> wrote: > Devin Jeanpierre wrote: >> >> 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. > > Certainly it's a Python pattern -- it's what you do to dynamically generate > code. > > >> 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? > > '--' not being allowed for a name has *nothing* to do with exec, and > everything to do with `--` not being a valid Python identifier. > > >> '--' is a valid attribute name on virtually any object that supports >> attribute setting (e.g. function objects). Of course, you need to use >> setattr() and getattr(). Is this really the reason, or is it a >> limitation caused primarily by the usage of exec and the need to >> prevent code injection? If somebody added this feature later on, would >> this create a security vulnerability in certain projects that used >> namedtuple in certain ways? > > So you think > > somevar = getattr(my_named_tuple, '--') > > is more readable than > > somevar = my_named_tuple.spam > > ? > > ~Ethan~ > -- > http://mail.python.org/mailman/listinfo/python-list >
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
all() is slow? "OKB (not okblacke)" <brenNOSPAMbarn@NObrenSPAMbarn.net> - 2011-11-07 21:00 +0000
Re: all() is slow? Chris Rebert <clp2@rebertia.com> - 2011-11-07 13:39 -0800
Re: all() is slow? david vierra <codewarrior0@gmail.com> - 2011-11-07 13:46 -0800
Re: all() is slow? Chris Angelico <rosuav@gmail.com> - 2011-11-08 09:06 +1100
Re: all() is slow? Henrik Faber <hfaber@invalid.net> - 2011-11-08 13:09 +0100
Re: all() is slow? Chris Angelico <rosuav@gmail.com> - 2011-11-08 23:14 +1100
Re: all() is slow? John Posner <jjposner@optimum.net> - 2011-11-08 17:51 -0500
Re: all() is slow? Tim Chase <python.list@tim.thechases.com> - 2011-11-08 17:56 -0600
Re: all() is slow? Devin Jeanpierre <jeanpierreda@gmail.com> - 2011-11-08 19:44 -0500
Re: all() is slow? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-11-09 02:47 +0000
Re: all() is slow? Devin Jeanpierre <jeanpierreda@gmail.com> - 2011-11-09 18:01 -0500
Re: all() is slow? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-11-09 23:11 +0000
Re: all() is slow? Devin Jeanpierre <jeanpierreda@gmail.com> - 2011-11-09 20:26 -0500
Re: all() is slow? alex23 <wuwei23@gmail.com> - 2011-11-09 19:50 -0800
Re: all() is slow? Devin Jeanpierre <jeanpierreda@gmail.com> - 2011-11-09 23:40 -0500
Re: all() is slow? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-11-10 07:35 +0000
Re: all() is slow? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-11-10 07:48 +0000
Re: all() is slow? Devin Jeanpierre <jeanpierreda@gmail.com> - 2011-11-10 03:51 -0500
Re: all() is slow? gene heskett <gheskett@wdtv.com> - 2011-11-10 08:20 -0500
Re: all() is slow? Terry Reedy <tjreedy@udel.edu> - 2011-11-10 14:25 -0500
Re: all() is slow? Devin Jeanpierre <jeanpierreda@gmail.com> - 2011-11-09 20:35 -0500
Re: all() is slow? Ian Kelly <ian.g.kelly@gmail.com> - 2011-11-09 19:10 -0700
Re: all() is slow? Ethan Furman <ethan@stoneleaf.us> - 2011-11-10 10:43 -0800
Re: all() is slow? Devin Jeanpierre <jeanpierreda@gmail.com> - 2011-11-10 15:37 -0500
Re: all() is slow? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-11-10 23:07 +0000
Re: all() is slow? Devin Jeanpierre <jeanpierreda@gmail.com> - 2011-11-10 23:35 -0500
Re: all() is slow? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-11-12 01:18 +0000
Re: all() is slow? Devin Jeanpierre <jeanpierreda@gmail.com> - 2011-11-13 01:28 -0500
Re: all() is slow? alex23 <wuwei23@gmail.com> - 2011-11-13 18:50 -0800
Re: all() is slow? Devin Jeanpierre <jeanpierreda@gmail.com> - 2011-11-13 23:48 -0500
Re: all() is slow? "OKB (not okblacke)" <brenNOSPAMbarn@NObrenSPAMbarn.net> - 2011-11-11 05:40 +0000
Re: all() is slow? Ian Kelly <ian.g.kelly@gmail.com> - 2011-11-10 14:19 -0700
Re: all() is slow? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-11-10 22:56 +0000
Re: all() is slow? Ethan Furman <ethan@stoneleaf.us> - 2011-11-10 13:47 -0800
Re: all() is slow? Chris Angelico <rosuav@gmail.com> - 2011-11-10 10:15 +1100
Re: all() is slow? Chris Angelico <rosuav@gmail.com> - 2011-11-09 12:19 +1100
Re: all() is slow? Chris Rebert <clp2@rebertia.com> - 2011-11-08 17:30 -0800
Re: all() is slow? Hans Mulder <hansmu@xs4all.nl> - 2011-11-09 16:41 +0100
Re: all() is slow? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2011-11-09 09:07 -0800
Re: all() is slow? John Nagle <nagle@animats.com> - 2011-11-09 14:16 -0800
Re: all() is slow? alex23 <wuwei23@gmail.com> - 2011-11-09 19:52 -0800
Re: all() is slow? "OKB (not okblacke)" <brenNOSPAMbarn@NObrenSPAMbarn.net> - 2011-11-10 19:35 +0000
Re: all() is slow? BOOK-AZ <amalguseynov@gmail.com> - 2011-11-15 08:02 -0800
csiph-web