PEP 263 comments

Stephen J. Turnbull stephen at xemacs.org
Mon Mar 4 12:00:33 EST 2002


>>>>> "Skip" == Skip Montanaro <skip at pobox.com> writes:

    Martin> A byte string should certainly be able to store arbitrary
    Martin> bytes. Under Stephen's proposal, it would indeed not be possible
    Martin> anymore to put arbitrary binary data into source code.

This is not clear, but it is certainly the easiest way to deal with
the issue.

    Skip> Just to make sure I understand correctly, under Stephen's
    Skip> propsal would

    Skip>     s = "\xff"

    Skip> be correct?

Correct in the sense that I'm sure it would be accepted.  However, it
would not necessarily be the only way to do it (in fact, it surely
would not).

    Skip>     s = "ÿ"

    Skip> (a literal 0377 character) would be an error, yes?

Assuming you mean that the source file contains eight bytes

0x73 0x20 0x3D 0x20 0x22 0xFF 0x22 0x0A

the parser should reject it, as 0xFF may not occur in a UTF-8-encoded
file.

However, Python would surely provide an optional module to
transparently decode that to UTF-8, before the parser proper sees it.
There would be no reason to write throwaway code in UTF-8 for pretty
much any language that already has codecs.

I'd like to emphasize that the point of my proposal is not to make
life harder for people who are just doing what comes naturally, and it
shouldn't.  AFAICT most of the things that people would like to do
will be just as easy to do under my proposal as under Martin's.

They just won't be sanctioned as part of "true" Python.  It's kind of
like a contract: you can translate it into other languages, but for
the purposes of legal interpretation, there is an original language
which is that of the court with jurisdiction.


-- 
Institute of Policy and Planning Sciences     http://turnbull.sk.tsukuba.ac.jp
University of Tsukuba                    Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
              Don't ask how you can "do" free software business;
              ask what your business can "do for" free software.



More information about the Python-list mailing list