diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-06-13 21:23:00 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-06-14 01:21:13 +0300 |
commit | 2ec38a17d4e357f8f12ee6a2643e2dd2ff7a426e (patch) | |
tree | 5bc282117e32cb70604b617d5692900529cc9ded /tests | |
parent | e9036c295ca1240946c122044e86ba8b569184e1 (diff) | |
download | micropython-2ec38a17d4e357f8f12ee6a2643e2dd2ff7a426e.tar.gz micropython-2ec38a17d4e357f8f12ee6a2643e2dd2ff7a426e.zip |
objstr: Be 8-bit clean even for repr().
This will allow roughly the same behavior as Python3 for non-ASCII strings,
for example, print("<phrase in non-Latin script>".split()) will print list
of words, not weird hex dump (like Python2 behaves). (Of course, that it
will print list of words, if there're "words" in that phrase at all, separated
by ASCII-compatible whitespace; that surely won't apply to every human
language in existence).
Diffstat (limited to 'tests')
-rw-r--r-- | tests/basics/string-repr.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/basics/string-repr.py b/tests/basics/string-repr.py index 34da483a57..2a3ef2527c 100644 --- a/tests/basics/string-repr.py +++ b/tests/basics/string-repr.py @@ -1,3 +1,4 @@ # anything above 0xa0 is printed as Unicode by CPython -for c in range(0xa1): +# the abobe is CPython implementation detail, stick to ASCII +for c in range(0x80): print("0x%02x: %s" % (c, repr(chr(c)))) |