[Python-3000] Immutable bytes type and dbm modules

Jim Jewett jimjjewett at gmail.com
Wed Aug 8 22:50:14 CEST 2007


On 8/8/07, Georg Brandl <g.brandl at gmx.net> wrote:
> Jim Jewett schrieb:

> > I'm not sure why you would need a literal for the mutable version.
> > How often do you create a new buffer with initial values?  (Note:  not
> > pointing to existing memory; creating a new one.)

> The same reason that you might create empty lists or dicts: to fill them.

Let me rephrase that -- how often do you create new non-empty buffers?

The equivalent of a empty list or dict is buffer().  If you really
want to save keystrokes, call it buf().  The question is whether we
really need to abbreviate

    >>> mybuf = buffer("abcde")

as

    >>> mybuf = b"abcde"

I would say leave literal syntax for the immutable type.

(And other than this nit, I also lend my support to Talin's suggestion.)

-jJ


More information about the Python-3000 mailing list