[Python-Dev] just say no...
Greg Stein
gstein@lyra.org
Fri, 12 Nov 1999 15:05:11 -0800 (PST)
This was done last year!! We have "s#" meaning "give me some bytes." We
have "t#" meaning "give me some 8-bit characters." The Python distribution
has been completely updated to use the appropriate format in each call.
The was done *specifically* to support the introduction of a Unicode type.
The intent was that "s#" returns the *raw* bytes of the Unicode string --
NOT a UTF-8 encoding!
As a separate argument, MAL can argue that "t#" should create an internal,
associated buffer to hold a UTF-8 encoding and then return that. But the
"s#" should return the raw bytes!
[ and I'll argue against the response to "t#" anyhow... ]
-g
On Fri, 12 Nov 1999, Jack Jansen wrote:
> The problem with "s" and "s#" is that they're already semantically
> overloaded, and will become more so with support for multiple charsets.
>
> Some modules use "s#" when they mean "give me a pointer to an area of memory
> and its length". Writing to binary files is an example of this.
>
> Some modules use it to mean "give me a pointer to a string". Writing to a text
> file is (probably) an example of this.
>
> Some modules use it to mean "give me a pointer to an 8-bit ASCII string". This
> is the case if we're going to actually look at the contents (think of
> string.upper() and such).
>
> I think that the only real solution is to define what "s" means, come up with
> new getarg-formats for the other two use cases and convert all modules to use
> the new standard. It'll still cause grief to extension modules that aren't
> part of the core, but at least the problem will go away after a while.
> --
> Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++
> Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++
> www.oratrix.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm
>
>
>
> _______________________________________________
> Python-Dev maillist - Python-Dev@python.org
> http://www.python.org/mailman/listinfo/python-dev
>
--
Greg Stein, http://www.lyra.org/