[Python-checkins] python/nondist/peps pep-0332.txt, NONE, 1.1 pep-0000.txt, 1.283, 1.284

goodger at users.sourceforge.net goodger at users.sourceforge.net
Fri Aug 27 15:44:40 CEST 2004


Update of /cvsroot/python/python/nondist/peps
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13095

Modified Files:
	pep-0000.txt 
Added Files:
	pep-0332.txt 
Log Message:
added PEP 332, "Byte vectors and String/Unicode Unification", by Skip Montanaro

--- NEW FILE: pep-0332.txt ---
PEP: 332
Title: Byte vectors and String/Unicode Unification
Version: $Revision: 1.1 $
Last-Modified: $Date: 2004/08/27 13:44:37 $
Author: Skip Montanaro <skip at pobox.com>
Status: Draft
Type: Standards Track
Content-Type: text/x-rst
Created: 11-Aug-2004
Python-Version: 2.5
Post-History:


Abstract
========

This PEP outlines the introduction of a raw ``bytes`` sequence object
and the unification of the current ``str`` and ``unicode`` objects.


Rationale
=========

Python's current string objects are overloaded.  They serve both to
hold ASCII and non-ASCII character data and to also hold sequences of
raw bytes which have no reasonable interpretation as displayable
character sequences.  This overlap hasn't been a big problem in the
past, but as Python moves closer to requiring source code to be
properly encoded, the use of strings to represent raw byte sequences
will be more problematic.  In addition, as Python's Unicode support
has improved, it's easier to consider strings as ASCII-encoded Unicode
objects.


Proposed Implementation
=======================

The number in parentheses indicates the Python version in which the
feature will be introduced.

- Add a ``bytes`` builtin which is just a synonym for ``str``. (2.5)

- Add a ``b"..."`` string literal which is equivalent to raw string
  literals, with the exception that values which conflict with the
  source encoding of the containing file not generate warnings. (2.5)

- Warn about the use of variables named "bytes". (2.5 or 2.6)

- Introduce a ``bytes`` builtin which refers to a sequence distinct
  from the ``str`` type. (2.6)

- Make ``str`` a synonym for ``unicode``. (3.0)


Bytes Object API
================

TBD.


Issues
======

- Can this be accomplished before Python 3.0?

- Should ``bytes`` objects be mutable or immutable?  (Guido seems to
  like them to be mutable.)


Copyright
=========

This document has been placed in the public domain.



..
   Local Variables:
   mode: indented-text
   indent-tabs-mode: nil
   sentence-end-double-space: t
   fill-column: 70
   End:

Index: pep-0000.txt
===================================================================
RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v
retrieving revision 1.283
retrieving revision 1.284
diff -u -d -r1.283 -r1.284
--- pep-0000.txt	23 Aug 2004 03:41:56 -0000	1.283
+++ pep-0000.txt	27 Aug 2004 13:44:37 -0000	1.284
@@ -121,6 +121,7 @@
  S   325  Resource-Release Support for Generators      Pedroni
  S   330  Python Bytecode Verification                 Pelletier
  S   331  Locale-Independent Float/String conversions  Reis
+ S   332  Byte vectors and String/Unicode Unification  Montanaro
  S   754  IEEE 754 Floating Point Special Values       Warnes
 
  Finished PEPs (done, implemented in CVS)
@@ -358,6 +359,7 @@
  SR  329  Treating Builtins as Constants in the Standard Library  Hettinger
  S   330  Python Bytecode Verification                 Pelletier
  S   331  Locale-Independent Float/String conversions  Reis
+ S   332  Byte vectors and String/Unicode Unification  Montanaro
  SR  666  Reject Foolish Indentation                   Creighton
  S   754  IEEE 754 Floating Point Special Values       Warnes
  I  3000  Python 3.0 Plans                             Kuchling, Cannon



More information about the Python-checkins mailing list