[Python-ideas] Integrate some itertools into the Python syntax
Nick Coghlan
ncoghlan at gmail.com
Thu Mar 24 22:41:06 EDT 2016
On 25 March 2016 at 07:20, Chris Barker <chris.barker at noaa.gov> wrote:
> for line in the_file[:10]:
> ...
>
> arrgg! files are not indexable!.
>
> (and by the way, not only for testing, but also when you really do want the
> next ten lines from the file -- maybe it's a header, or...)
>
> Sure, I have plenty of ways to work around this, but frankly, they are all a
> bit ugly, even if trivial.
>
> So maybe there should be some ability to index / slice iterables?
I like the concept of focusing on working with file iterators and file
processing concepts like head, tail and cat as a concrete example -
starting by designing a clean solution to a specific problem and
generalising from there is almost always a much better approach than
trying to design the general case without reference to specific
examples.
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
More information about the Python-ideas
mailing list