Assigning generator expressions to ctype arrays

Patrick Maupin pmaupin at gmail.com
Fri Oct 28 14:05:05 EDT 2011


On Oct 27, 10:23 pm, Terry Reedy <tjre... at udel.edu> wrote:


> I do not think everyone else should suffer substantial increase in space
> and run time to avoid surprising you.

What substantial increase?  There's already a check that winds up
raising an exception.  Just make it empty an iterator instead.

> > It violates the principle of least surprise
>
> for ctypes to do what is most efficient in 99.9% of uses?

It doesn't work at all with an iterator, so it's most efficient 100%
of the time now.  How do you know how many people would use iterators
if it worked?

>
> It could, but at some cost. Remember, people use ctypes for efficiency,

yes, you just made my argument for me.  Thank you.  It is incredibly
inefficient to have to create a temp array.

> so the temp array path would have to be conditional.

I don't understand this at all.  Right now, it just throws up its
hands and says "I don't work with iterators."  Why would it be a
problem to change this?



More information about the Python-list mailing list