On 11/13/2021 4:35 PM, pt...@austin.rr.com wrote:
Iโve not been following the thread, but Steve Holden forwarded me the
To explore the extreme case, I wrote a pyparsing transformer to convert
identifiers in a body of Python source to mixed font, equivalent to the
original source after NFKC normalization. Here are hello.py, and a
snippet from unittest/utils.py:
def ๐๐ฎ๐๐๐():
ย ย ย try:
๐ฅe๐
๐๐๏ธด = "Hello"
๐จ๐ฌr๐ตแต๏น = "World"
ย ย ย ย ย ย ย แต๐๐ข๐ฏ๐ฝ(f"{๐ต๏ฝ
๐ต๐ฉยบ_}, {๐โ๐lโ
๏ธด}!")
ย ย ย except ๐ฃ๐ชแต๏ฝ
๐ค๐ฟแตฃ๐๐ as โ
๐c:
๐rโนโโ("failed: {}".๐๐ผสณแตยช๏ฝ(แต๐ฑ๐ฌ))
if _๏ธดโฟ๐ช๐๐__ == "__main__":
๐eโหก๐()
# snippet from unittest/util.py
_๐โ
ฌ๐ ๐ฒ๐โ๐ชLแดฐ๐ฌ๐ฝ๏น๐ท๐ผ๐ก = 12
def _๐ฐสฐ๐ธสณ๐ฅ๐๐(๐ฐ, p๐๐ข๏ฌ๐๐๐๐, ๏ฝแตค๐๐ณ๐๐ฅ๐นโ๐):
ย ย ย หข๐ธ๏ฝ๐ฝ = ๐ฅ๏ฝ
๐ฏ(๐) - ๏ฝr๐๐๐ขx๐
แต๐ท - ๐๐ช๏ฌ๏ฝ๐
๐น๐โ
ย ย ย if s๏ฝi๐ฑ > _๐๐๐ ๐๐ดH๐บ๏ผฌ๐ฏ๐๐๏นL๐๐ฉ:
๐ด = '%s[%d chars]%s' % (๐จ[:๐ฑ๐ซ๐๐๐๏ฝโ๐๐], โ๐๐p, ๐ผ[๐๐๐(๐) -
๐จ๐๐๏ฌx๐กแต๐ฏ:])
ย ย ย return โ
You should able to paste these into your local UTF-8-aware editor or IDE
and execute them as-is.
Wow. After pasting the util.py snippet into current IDLE, which on my
Windows machine* displays the complete text:
>>> dir()
['_PLACEHOLDER_LEN', '__annotations__', '__builtins__', '__doc__',
'__loader__', '__name__', '__package__', '__spec__', '_shorten']
>>> _shorten('abc', 1, 1)
'abc'
>>> _shorten('abcdefghijklmnopqrw', 2, 2)
'ab[15 chars]rw'
* Does not at all work in CommandPrompt, even after supposedly changing
to a utf-8 codepage with 'chcp 65000'.
--
Terry Jan Reedy
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at
https://mail.python.org/archives/list/python-dev@python.org/message/NSGBCZQ2R6G2HGPAID4ZI35YCRMF7ERC/
Code of Conduct: http://python.org/psf/codeofconduct/