Chris Angelico writes:

 > If I'm reading this correctly, the result from f.tell() has enough
 > information to reconstruct a position within a hypothetical array
 > of code points contained within the file (that is to say - if you
 > read the entire file into a string, f.tell() returns something that
 > can be turned into an index into that string), but that position
 > might not actually correspond to a single byte location. Is that it?

That's what the OP wants.  That's not what f.tell does.  f.tell
returns information sufficient to recreate the state of the stream I/O
part of a codec when it reaches that point in the stream.  Its
*purpose* is to support producing the rest of the str produced by
f.read() after a shorter read, but f.tell doesn't care if the str ever
existed or ever will exist in the process that calls it.

 > I think UTF-7 is an awesome encoding. Really good at destroying
 > people's expectations of what they thought they could depend on.
 > 
 > (Terrible for actually using, though.)

Better than the alternatives for its intended use cases, which tells
you a lot about the hostile environment RFC-822 created for the rest
of the world. ;-)

_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/U6RQ325GOS7232G2SGIOSN3IOZF2VH63/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to