Message377484
> I like the simple ad easy 'slice replacement = iterator' form
> because it illustrates to me that we have done something
> right with Python's design.
I understand that you like it and that it reflects the way you think the world should work, , but that doesn't warrant putting it in the FAQ. We should steer users down a path of feeding unsizable inputs into tooling that needs a size to work well (the receiving code either has to implicitly build a list first before it can start or it will have to have periodic resizes). A straight list comprehension will suffice to answer the question cleanly.
FWIW, the same issue occurs with str.join(). It works better with a list comprehension than an iterator. Given an iterator, it has to build an internal list first before it can start. That is slower than starting with a list in the first place and makes the memory consumption implicit when it should be explicit (a generator would create the illusion that a list isn't being formed which is misleading). |
|
Date |
User |
Action |
Args |
2020-09-25 08:31:09 | rhettinger | set | recipients:
+ rhettinger, terry.reedy, paul.moore, eric.smith, steven.daprano, sreedevi.ha |
2020-09-25 08:31:09 | rhettinger | set | messageid: <1601022669.0.0.613042559421.issue41774@roundup.psfhosted.org> |
2020-09-25 08:31:08 | rhettinger | link | issue41774 messages |
2020-09-25 08:31:08 | rhettinger | create | |
|