Movatterモバイル変換
[0]ホーム
[Python-Dev] The -U flag
M.-A. Lemburgmal@lemburg.com
Mon, 14 Oct 2002 09:37:06 +0200
Guido van Rossum wrote:>>Since Python allows Unicode strings in sys.path, we are making>>progress on getting -U to work. When entering interactive mode, the>>stumbling block is>>>>_idmap = ''>>for i in range(256): _idmap = _idmap + chr(i)>>del i>>>>Here, _idmap is initialized with a Unicode string, and the chr(i)>>results are promoted to Unicode, which eventually causes a>>UnicodeErorr when you get past 127.>>>>The work-around would be to write>>>>_idmap = str('')>>for i in range(256): _idmap = _idmap + chr(i)>>del i>>>>With that, we can enter interactive mode in python -U.>>>>Is such a change acceptable?>>> Only with a comment that explains it -- otherwise the next person> looking at the code will remove it.Wouldn't the following be faster ?l = map(chr, range(256))_idmap = str('').join(l)del l> But didn't we at one point conclude that -U was never gonna work? And> wasn't that why it's no longer documented?I don't remember such a conclusion. The reason for having -Uin the first place was to test the Python standard lib forbeing able to handle Unicode seemlessly. Obviously we are stillfar from having reached that point, but it's a good way ofbeing able to test the compatibility.It's no longer documented to reduce the number of bug-reportswe get for it. It was never meant to be used by users (at thispoint), just by developers.-- Marc-Andre LemburgCEO eGenix.com Software GmbH_______________________________________________________________________eGenix.com -- Makers of the Python mx Extensions: mxDateTime,mxODBC,...Python Consulting:http://www.egenix.com/Python Software:http://www.egenix.com/files/python/
[8]ページ先頭