[Python-Dev] Allowing u.encode() to return non-strings (original) (raw)
"Martin v. Löwis" martin at v.loewis.de
Thu Jul 1 23:45:52 CEST 2004
- Previous message: [Python-Dev] Including translated doc strings in 2.4
- Next message: [Python-Dev] Re: Candidate Itertools
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Bill Janssen wrote:
I assume, though, that the args to "read()" and friends are still about bytes.
Yes. It is not possible to determine, in advance, the number of bytes needed to decode a given number of characters. Therefore, a codec typically needs to either read more bytes than requested, or return less characters (if the bytes read don't happen to end on a character boundary).
So the size parameter to .read() is just a hint - a codec might chose to completely ignore it.
Regards, Martin
- Previous message: [Python-Dev] Including translated doc strings in 2.4
- Next message: [Python-Dev] Re: Candidate Itertools
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]