[Python-ideas] + operator on generators

Sven R. Kunze srkunze at mail.de
Wed Jun 28 18:29:44 EDT 2017


On 28.06.2017 20:37, Koos Zevenhoven wrote:

> Oh, I've been very close to getting one of those. But then I should 
> probably get a pair of glasses too ;).

:D

> ​​That pattern annoys people and negates the benefits of views and 
> generators.​

Sure, that's why I am in favor of this proposal. It would remove the 
necessity to do that in various places. :)

>
> Sure, but you may want to turn your unknown sources into something 
> predictable as soon as possible. You'll need to deal with the errors 
> in the input anyway.

That's a good point.

> Very often one doesn't really need a list, but just something that has 
> indexing, slicing and/or len(). Wrapping things with list() can be ok, 
> but uses memory and is O(n). Generating lists from all kinds of 
> iterables all the time is just a whole bunch of unnecessary overhead. 
> But yes, it happens, because that's the convenient way of doing it 
> now. That's like going back to Python 2, but with additional calls to 
> list() required. Maybe you're lucky that your iterables are small and 
> not a bottle neck and/or you just don't feel guilty every time you 
> call list() where you shouldn't have to ;).

Yep, exactly. That's why I like an easier way of concating them with no 
bells and whistles. Preferably like lists today. ;)


Cheers,
Sven

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20170629/da72defc/attachment.html>


More information about the Python-ideas mailing list