"Guido van Rossum" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
| 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




_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to