[Python-3000] Immutable bytes type and dbm modules

Neil Toronto ntoronto at cs.byu.edu
Wed Aug 8 04:37:51 CEST 2007


Greg Ewing wrote:
> Guido van Rossum wrote:
>   
>> That would imply that b"..." should return a mutable bytes object,
>> which many people have objected to.
>>     
>
> I'm still very uncomfortable about this. It's so
> completely unlike anything else in the language.
> I have a strong feeling that it is going to trip
> people up a lot, and end up being one of the
> Famous Warts To Be Fixed In Py4k.
>
> There's some evidence of this already in the way
> we're referring to it as a "bytes literal", when
> it's *not* actually a literal, but a constructor.
> Or at least it's a literal with an implied
> construction operation around it.
>   

Not only that, but it's the only *string prefix* that causes the 
interpreter to create and return a mutable object.

It's not too late to go with Talin's suggestions (bytes = immutable, 
buffer = mutable), is it? I got warm fuzzies reading that.

Neil



More information about the Python-3000 mailing list