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


Groups > comp.lang.python > #15521

Re: all() is slow?

References (3 earlier) <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>
From Devin Jeanpierre <jeanpierreda@gmail.com>
Date 2011-11-09 20:35 -0500
Subject Re: all() is slow?
Newsgroups comp.lang.python
Message-ID <mailman.2581.1320888952.27778.python-list@python.org> (permalink)

Show all headers | View raw


> 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 <jeanpierreda@gmail.com> 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
> <steve+comp.lang.python@pearwood.info> 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
>>
>

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


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