On 8/5/07, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote:
> This brings me to join others in the desire for
> immutable bytes objects: I think such a type is
> needed, and it should probably use the same
> hash algorithm as str8.
>
> I don't think it needs to be a separate type,
> instead, bytes objects could have a idem-potent
> .freeze() method which switches the "immutable"
> bit on. There would be no way to switch it off
> again.

I'm sorry, but this is unacceptable. It would make all reasoning based
upon the type of the object unsound: if type(X) == bytes, is it
hashable? Can we append, delete or replace values? What is the type of
a slice of it? If it is currently mutable, will it still be mutable
after I call some other function on it?

Python has traditionally always used a separate type for this purpose:
list vs. tuple, set vs. frozenset. If we are have to have a frozen
bytes type, it should be a separate type.

> If that is not acceptable, please tell me how else
> to fix the dbm modules.

By fixing the code that uses them? By using str8 (perhaps renamed to
frozenbytes and certainly stripped of its locale-dependent APIs)?

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)
_______________________________________________
Python-3000 mailing list
[email protected]
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