[Python-Dev] Re: adding a bytes sequence type to Python (original) (raw)
M.-A. Lemburg mal at egenix.com
Wed Aug 18 10:41:36 CEST 2004
- Previous message: [Python-Dev] Re: adding a bytes sequence type to Python
- Next message: [Python-Dev] Re: adding a bytes sequence type to Python
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Martin v. Löwis wrote:
M.-A. Lemburg wrote:
Anyway, this whole discussion about a new bytes type doesn't really solve the problem that the b'...' literal was intended for: that of having a nice way to define (read-only) 8-bit binary string literals. But why do you need a way to spell 8-bit string literals?
You can always do
"string".encode("L1") If that is too much typing, do def b(s):return s.encode("L1") b("string")
You need to think about the important use-case of having to convert Py2 applications to Py3 style. In many cases, the application can be made to run under Py3 be adding the small 'b' in front of the used string literals.
Even better: if we add the b'xxx' notation now, we could start working towards the switch-over by slowly converting the Python standard library to actually work in -U mode (which basically implements the switch-over by making 'abc' behave as u'abc').
Since the code is already in place and the change is minimal, I don't see any reason not to use it.
-- Marc-Andre Lemburg eGenix.com
Professional Python Services directly from the Source (#1, Aug 18 2004)
Python/Zope Consulting and Support ... http://www.egenix.com/ mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::
- Previous message: [Python-Dev] Re: adding a bytes sequence type to Python
- Next message: [Python-Dev] Re: adding a bytes sequence type to Python
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]