[Python-3000] encoding hell

"Martin v. Löwis" martin at v.loewis.de
Wed Sep 13 06:22:16 CEST 2006


Fredrik Lundh schrieb:
>> The best you could do would be to return some kind
>> of opaque object from tell() that could be passed
>> back to seek().
> 
> that's how seek/tell works on text files in today's Python, of course. 
> if you're writing portable code, you can only seek to the beginning or 
> end of the file, or to a position returned to you by tell.

The problem is that for character-oriented streams, that position
should also incorporate the "shift state" of the codec. To support
that, the codec API would need to grow a way to export and import
its state into such "tell objects".

Regards,
Martin


More information about the Python-3000 mailing list