On Thu, 24 Feb 2005 16:51:22 -0500, Christopher De Vries
<[EMAIL PROTECTED]> wrote:

[snip]

>I think this is a definite improvement... especially putting the buffer size
>and line terminators as optional arguments, and handling empty files. I think,
>however that the if splitstr[-1]: ... else: ... clauses aren't necessary,

Indeed. Any efficiency gain would be negated by the if test and it's
only once per buffer-full anyway. I left all that stuff in to show
that I had actually analyzed the four cases i.e. it wasn't arrived at
by lucky accident.

> so I
>would probably reduce it to this:
>
[snip]
>
>Popping off that last member and then iterating over the rest of the list as
>you suggested is so much more efficient, and it looks a lot better. 

Yeah. If it looks like a warthog, it is a warthog. The converse is of
course not true; examples of elegant insufficiency abound.

Cheers,
John

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to