[Python-3000] Thoughts on new I/O library and bytecode

Terry Reedy tjreedy at udel.edu
Fri Feb 23 02:11:36 CET 2007


"Guido van Rossum" <guido at python.org> wrote in message 
news:ca471dc20702221601s703a9fe4i8fc69810b8fb8da6 at mail.gmail.com...
| FWIW, I've updated PEP 358 (the bytes object) to more closely reflect
| my plans for it, showing the preservation of most string methods. It
| should be updated on the website in a few minutes.
|
| If someone would like to volunteer a small PEP on the b"..." literal I
| would appreciate it. The main concern here is that bytes objects are
| mutable; I think the right semantics will be that each time a b"..."
| literal is evaluated a *new* bytes object is created, just like [1, 2,
| 3] constructs a new list each time it is evaluated.

I always thought that aliasing of immutable objects was an 
implementation-dependent optimization, so that seems right.  Certainly,

a=[]
for i in range(3): a.append(b'bytes')

had better append three separate objects.  Someone who wants just one can 
write

a = 3*[b'bytes']

Is a separate PEP really needed, rather that a few lines in PEP358?

tjr






More information about the Python-3000 mailing list