Iterator addition

Tom Anderson twic at urchin.earth.li
Sun Nov 13 18:57:48 CET 2005


On Sun, 13 Nov 2005, Reinhold Birkenfeld wrote:

> bearophileHUGS at lycos.com wrote:
>
>> Tom Anderson:
>
>>> And we're halfway to looking like perl already! Perhaps a more 
>>> pythonic thing would be to define a "then" operator:
>>>
>>> all_lines = file1 then file2 then file3
>>
>> Or a "chain" one:
>>
>> all_lines = file1 chain file2 chain file3

This may just be NIH syndrome, but i like that much less - 'then' makes 
for something that reads much more naturally to me. 'and' would be even 
better, but it's taken; 'andthen' is a bit unwieldy.

Besides, "chain file2" is going to confuse people coming from a BASIC 
background :).

> That's certainly not better than the chain() function. Introducing new 
> operators for just one application is not pythonic.

True, but would this be for just one application With python moving 
towards embracing a lazy functional style, with generators and genexps, 
maybe chaining iterators is a generally useful operation that should be 
supported at the language level. I'm not seriously suggesting doing this, 
but i don't think it's completely out of the question.

tom

-- 
limited to concepts that are meta, generic, abstract and philosophical --
IEEE SUO WG



More information about the Python-list mailing list