Victor Stinner wrote:
>> Will ascii() ever emit an antislash representation?
> Try ascii(chr(0x1fffff)).
In which version? I get:
ValueError: chr() arg not in range(0x110000)
> How do you plan to use this output? Write it into a socket or a file?
> When I debug, I use print & logging which both expect text string. So I
> think that b'%a' is useless.
Sad Use Case 1:
There is not yet a working implementation of the file
or wire format. Either I am still writing it, or the
file I need to parse is coming from a "partner" who
"configured" rather than wrote the original program.
I write (or request that they write) something
recognizable to the actual stream, as a landmark.
Case 1a: I want a repr of the same object that is
supposedly being represented in the official format,
so I can see whether the problem is bad data or
bad serialization.
Use Case 2:
Fallback for some sort of serialization format;
I expect not to ever use the fallback in production,
but better something ugly than a failure, let alone
a crash.
Use Case 3:
Shortcut for serialization of objects whose repr is
"good enough". (My first instinct would probably be
to implement the __bytes__ special method, but if I
thought that was supposed to expose the real data,
as opposed to a serialized copy, then I would go
for %a.)
-jJ
--
If there are still threading problems with my replies, please
email me with details, so that I can try to resolve them. -jJ
_______________________________________________
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com