[Python-Dev] Suggestion for a new built-in (original) (raw)
Josiah Carlson jcarlson at uci.edu
Fri Sep 22 22:17:23 CEST 2006
- Previous message: [Python-Dev] Suggestion for a new built-in - flatten
- Next message: [Python-Dev] Suggestion for a new built-in - flatten
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"Bob Ippolito" <bob at redivi.com> wrote:
On 9/22/06, Brian Harring <ferringb at gmail.com> wrote: > On Fri, Sep 22, 2006 at 12:05:19PM -0700, Bob Ippolito wrote: > > I think instead of adding a flatten function perhaps we should think > > about adding something like Erlang's "iolist" support. The idea is > > that methods like "writelines" should be able to take nested iterators > > and consume any object they find that implements the buffer protocol. > > Which is no different then just passing in a generator/iterator that > does flattening. > > Don't much see the point in gumming up the file protocol with this > special casing; still will have requests for a flattener elsewhere. > > If flattening was added, should definitely be a general obj, not a > special casing in one method in my opinion.
I disagree, the reason for iolist is performance and convenience; the required indirection of having to explicitly call a flattener function removes some optimization potential and makes it less convenient to use.
Sorry Bob, but I disagree. In the few times where I've needed to 'write a list of buffers to a file handle', I find that iterating over the buffers to be sufficient. And honestly, in all of my time dealing with socket and file IO, I've never needed to write a list of iterators of buffers. Not to say that YAGNI, but I'd like to see an example where
- it was being used in the wild, and 2) where it would be a measurable speedup.
- Josiah
- Previous message: [Python-Dev] Suggestion for a new built-in - flatten
- Next message: [Python-Dev] Suggestion for a new built-in - flatten
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]