[Python-3000] bytes regular expression?

Victor Stinner victor.stinner at haypocalc.com
Fri Aug 10 12:09:30 CEST 2007


On Thursday 09 August 2007 19:21:27 Thomas Heller wrote:
> Victor Stinner schrieb:
> > I prefer str8 which looks to be a good candidate for "frozenbytes" type.
>
> I love this idea!  Leave str8 as it is, maybe extend Python so that it
> understands the s"..." literals and we are done.

Hum, today str8 is between bytes and str types. str8 has more methods (eg. 
lower()) than bytes, its behaviour is different in comparaison (b'a' != 'a' 
but str8('a') == 'a') and issubclass(str8, basestring) is True.

I think that a frozenbytes type is required for backward compatibility (in 
Python 2.x, "a" is immutable). Eg. use bytes as key for a dictionary (looks 
to be needed in re and dbm modules).

Victor Stinner aka haypo
http://hachoir.org/


More information about the Python-3000 mailing list