[Python-ideas] Deprecate str.find
Antoine Pitrou
solipsis at pitrou.net
Fri Jul 15 21:28:02 CEST 2011
On Fri, 15 Jul 2011 20:26:42 +0200
Georg Brandl <g.brandl at gmx.net> wrote:
>
> Sorry, I don't see the immense complication in
>
> try:
> line = readline()
> except StopIteration:
> line = ''
>
> Of course, if the tokenize API was designed from scratch nowadays,
> it would probably only accept iterables, and you'd have to make one
> yourself from a file object using
>
> iter(fd.readline, '')
Or, since file objects are iterable out of the box, you could simply
pass the file object.
Regards
Antoine.
More information about the Python-ideas
mailing list