<div dir="ltr"><br><br>On Tuesday, July 19, 2016 at 12:39:04 PM UTC+5:30, Neil Girdhar wrote:<blockquote class="gmail_quote" style="margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir="ltr">One solution would be to restrict identifiers to only Unicode characters in appropriate classes.  The open quotation mark is in the code class for punctuation, so it doesn't make sense to have it be part of an identifier.<div><br></div><div><a href="http://www.fileformat.info/info/unicode/category/index.htm" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.fileformat.info%2Finfo%2Funicode%2Fcategory%2Findex.htm\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFw2oe3S29v48h0UwSdMvWGddEASA';return true;" onclick="this.href='http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.fileformat.info%2Finfo%2Funicode%2Fcategory%2Findex.htm\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFw2oe3S29v48h0UwSdMvWGddEASA';return true;">http://www.fileformat.info/<wbr>info/unicode/category/index.<wbr>htm</a></div></div></blockquote><div><br>Python (3) is doing that alright as far as I can see:<br>https://docs.python.org/3/reference/lexical_analysis.html#identifiers<br><br>The point is that when it doesn’t fall in the classification(s) the error it raises suggests that the lexer is not really unicode-aware<br> </div><blockquote class="gmail_quote" style="margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir="ltr"><div><br><br>On Tuesday, July 19, 2016 at 1:29:35 AM UTC-4, Rustom Mody wrote:<blockquote class="gmail_quote" style="margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">On Tuesday, July 19, 2016 at 10:20:29 AM UTC+5:30, Nick Coghlan wrote:<blockquote class="gmail_quote" style="margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex">On 18 July 2016 at 13:41, Rustom Mody <<a rel="nofollow">rusto...@gmail.com</a>> wrote:<br>> Do consider:<br>><br>>>>> Α = 1<br>>>>> A = 2<br>>>>> Α + 1 == A<br>> True<br>>>>><br>><br>> Can (IMHO) go all the way to<br>> <a href="https://en.wikipedia.org/wiki/IDN_homograph_attack" rel="nofollow" target="_blank" onmousedown="this.href='https://www.google.com/url?q\x3dhttps%3A%2F%2Fen.wikipedia.org%2Fwiki%2FIDN_homograph_attack\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNENbb3THheSvkycUC5ZkgqyV68DhA';return true;" onclick="this.href='https://www.google.com/url?q\x3dhttps%3A%2F%2Fen.wikipedia.org%2Fwiki%2FIDN_homograph_attack\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNENbb3THheSvkycUC5ZkgqyV68DhA';return true;">https://en.wikipedia.org/wiki/<wbr>IDN_homograph_attack</a><p>Yes, we know - that dramatic increase in the attack surface is why<br>PyPI is still ASCII only, even though full Unicode support is<br>theoretically possible.</p><p>It's not a major concern once an attacker already has you running<br>arbitrary code on your system though, as the main problem there is<br>that they're *running arbitrary code on your system*. , That means the<br>usability gains easily outweigh the increased obfuscation potential,<br>as worrying about confusable attacks at that point is like worrying<br>about a dripping tap upstairs when the Brisbane River is already<br>flowing through the ground floor of your house :)</p><p>Cheers,</p><br></blockquote><div><br>There was this question on the python list a few days ago:<br>Subject: SyntaxError: Non-ASCII character<br><br>Chris Angelico pointed out the offending line:<br>wf = wave.open(“test.wav”, “rb”)<br>(should be wf = wave.open("test.wav", "rb") instead)<br><br>Since he also said:<br>> The solution may be as simple as running "python3 script.py" rather than "python script.py".<br><br>I pointed out that the python2 error was more helpful (to my eyes) than python3s<br><br><br>Python3 <br><br>Traceback (most recent call last):<br>  File "<stdin>", line 1, in <module><br>  File "/home/ariston/foo.py", line 31<br>    wf = wave.open(“test.wav”, “rb”)<br>                       ^<br>SyntaxError: invalid character in identifier<br><br>Python2<br><br><br>Traceback (most recent call last):<br>  File "<stdin>", line 1, in <module><br>  File "foo.py", line 31<br>SyntaxError: Non-ASCII character '\xe2' in file foo.py on line 31, but no encoding declared; see <a href="http://python.org/dev/peps/pep-0263/" rel="nofollow" target="_blank" onmousedown="this.href='http://www.google.com/url?q\x3dhttp%3A%2F%2Fpython.org%2Fdev%2Fpeps%2Fpep-0263%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHy5aLggsxgBzUi3uR-nkgFp73I8w';return true;" onclick="this.href='http://www.google.com/url?q\x3dhttp%3A%2F%2Fpython.org%2Fdev%2Fpeps%2Fpep-0263%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHy5aLggsxgBzUi3uR-nkgFp73I8w';return true;">http://python.org/dev/peps/<wbr>pep-0263/</a> for details <br><br>IOW<br>1. The lexer is internally (evidently from the error message) so ASCII-oriented that any “unicode-junk” just defaults out to identifiers (presumably comments are dealt with earlier) and then if that lexing action fails it mistakenly pinpoints a wrong *identifier* rather than just an impermissible character like python 2<br>combine that with<br>2. matrix mult (@) Ok to emulate perl but not to go outside ASCII<br><br>makes it seem  (to me) python's unicode support is somewhat wrongheaded.<br><br></div></div></blockquote></div></div></blockquote></div>