This would presumaby support the (read-only part of the) buffer API so
search would be covered.

I don't see a use case for replace.

Alternatively, you could always specify Latin-1 as the encoding and
convert it that way -- I don't think there's any input that can cause
Latin-1 decoding to fail.

On 10/3/05, Antoine Pitrou <[EMAIL PROTECTED]> wrote:
> Le lundi 03 octobre 2005 à 14:02 -0700, Guido van Rossum a écrit :
> > On 10/3/05, Antoine Pitrou <[EMAIL PROTECTED]> wrote:
> > > Could the "bytes" type be just the same as the current "str" type but
> > > without the implicit unicode conversion ? Or am I missing some desired
> > > functionality ?
> >
> > No. It will be a mutable array of bytes. It will intentionally
> > resemble strings as little as possible. There won't be a literal for
> > it.
>
> Thinking about it, it may have to offer the search and replace
> facilities offered by strings (including regular expressions).
>
> Here is an use case : say I'm reading an HTML file (or receiving it over
> the network). Since the character encoding can be specified in the HTML
> file itself (in the <head>...</head>), I must first receive it as a
> bytes object. But then I must fetch the encoding information from the
> HTML header: therefore I must use some string ops on the bytes object to
> parse this information. Only after I have discovered the encoding, can I
> finally convert the bytes object to a text string.
>
> Or would there be another way to do it?
>
>
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev@python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: 
> http://mail.python.org/mailman/options/python-dev/guido%40python.org
>


--
--Guido van Rossum (home page: http://www.python.org/~guido/)
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to