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


Groups > comp.lang.python > #15095

Re: Assigning generator expressions to ctype arrays

From Terry Reedy <tjreedy@udel.edu>
Subject Re: Assigning generator expressions to ctype arrays
Date 2011-10-28 04:19 -0400
References <32ee8e3e-4d42-4d2e-bdc7-087970c2736e@hv4g2000vbb.googlegroups.com> <4ea9dbd0$0$29968$c3e8da3$5496439d@news.astraweb.com> <43aea5ad-bc9f-4e82-a9d5-74a06553a2ad@q16g2000yqn.googlegroups.com> <4eaa580a$0$29968$c3e8da3$5496439d@news.astraweb.com>
Newsgroups comp.lang.python
Message-ID <mailman.2278.1319789992.27778.python-list@python.org> (permalink)

Show all headers | View raw


On 10/28/2011 3:21 AM, Steven D'Aprano wrote:

> If the slice has too few elements, you've just blown away the entire
> iterator for no good reason.

> If the slice is the right length, but the iterator doesn't next raise
> StopIteration, you've just thrown away one perfectly good value. Hope it
> wasn't something important.

You have also over-written values that should be set back to what they 
were, before the exception is raised, which is why I said the test needs 
to be done with a temporary array.

-- 
Terry Jan Reedy

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


Thread

Assigning generator expressions to ctype arrays Patrick Maupin <pmaupin@gmail.com> - 2011-10-27 13:34 -0700
  Re: Assigning generator expressions to ctype arrays Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-10-27 22:31 +0000
    Re: Assigning generator expressions to ctype arrays Patrick Maupin <pmaupin@gmail.com> - 2011-10-27 17:09 -0700
      Re: Assigning generator expressions to ctype arrays Terry Reedy <tjreedy@udel.edu> - 2011-10-27 23:23 -0400
        Re: Assigning generator expressions to ctype arrays Patrick Maupin <pmaupin@gmail.com> - 2011-10-28 11:05 -0700
          Re: Assigning generator expressions to ctype arrays Terry Reedy <tjreedy@udel.edu> - 2011-10-28 16:24 -0400
            Re: Assigning generator expressions to ctype arrays Patrick Maupin <pmaupin@gmail.com> - 2011-10-29 07:43 -0700
      Re: Assigning generator expressions to ctype arrays Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-10-28 07:21 +0000
        Re: Assigning generator expressions to ctype arrays Terry Reedy <tjreedy@udel.edu> - 2011-10-28 04:19 -0400
          Re: Assigning generator expressions to ctype arrays Patrick Maupin <pmaupin@gmail.com> - 2011-10-28 14:51 -0700
            Re: Assigning generator expressions to ctype arrays Patrick Maupin <pmaupin@gmail.com> - 2011-10-28 16:27 -0700
              Re: Assigning generator expressions to ctype arrays Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-10-29 01:01 +0000
                Re: Assigning generator expressions to ctype arrays Patrick Maupin <pmaupin@gmail.com> - 2011-10-28 19:14 -0700

csiph-web