> > >>> >> (You forgot "/Uhhhhhhhh" representation (it's an antislah, but I don't >> see the key on my Mac keyboard?).) >> > > Hard to forget what you don't know. ;) Will ascii() ever emit an > antislash representation?
Try ascii(chr(0x1fffff)). What is the use case of this *new* formatter? How do you use it? >> > > An aid to debugging -- need to see what's what at that moment? Toss it > into %a. It is not intended for production code, but is included to > hopefully circumvent the inappropriate use of __bytes__ methods on classes. 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. > print(b'%a" % 123) may emit a BytesWarning and may lead to bugs. >> > > Why would it emit a BytesWarning? Because print expects a text string, and print(bytes) does an implicit conversion to Unicode. Try: python -bb -c "print(b'hello')". Victor
_______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com