Movatterモバイル変換


[0]ホーム

URL:


[Python-Dev] Internal representation of strings and Micropython

Chris Angelicorosuav at gmail.com
Wed Jun 4 04:32:12 CEST 2014


On Wed, Jun 4, 2014 at 11:17 AM, Steven D'Aprano <steve at pearwood.info> wrote:> * Having a build-time option to restrict all strings to ASCII-only.>>   (I think what they mean by that is that strings will be like Python 2>   strings, ASCII-plus-arbitrary-bytes, not actually ASCII.)What I was actually suggesting along those lines was that the str typestill be notionally a Unicode string, but that any codepoints >127would either raise an exception or blow an assertion, and all the codeto handle multibyte representations would be compiled out. So there'dstill be a difference between strings of text and streams of bytes,but all encoding and decoding to/from ASCII-compatible encodings wouldjust point to the same bytes in RAM.Risk: Someone would implement that with assertions, then compile withassertions disabled, test only with ASCII, and have lurking bugs.ChrisA


More information about the Python-Devmailing list

[8]ページ先頭

©2009-2025 Movatter.jp