tail

Greg Ewing greg.ewing at canterbury.ac.nz
Sun May 8 19:58:32 EDT 2022


On 9/05/22 7:47 am, Marco Sulla wrote:
>> It will fail if the contents is not ASCII.
> 
> Why?

For some encodings, if you seek to an arbitrary byte position and
then read, it may *appear* to succeed but give you complete gibberish.

Your method might work for a certain subset of encodings (those that
are self-synchronising) but it won't work for arbitrary encodings.

Given that limitation, I don't think it's reliable enough to include
in the standard library.

-- 
Greg



More information about the Python-list mailing list