[Python-3000-checkins] r45652 - in python/branches/p3yk

Guido van Rossum guido at python.org
Tue Apr 25 20:33:34 CEST 2006


On 4/25/06, Neil Schemenauer <nas at arctrix.com> wrote:
> On Tue, Apr 25, 2006 at 09:52:34AM -0700, Guido van Rossum wrote:
> > On 4/22/06, Neil Schemenauer <nas at arctrix.com> wrote:
> > > On Sun, Apr 23, 2006 at 01:28:06AM +0200, guido.van.rossum wrote:
> > > > +bytes_nohash(PyObject *self)
> > > > +{
> > > > +    PyErr_SetString(PyExc_TypeError, "bytes objects are unhashable");
> > > > +    return -1;
> > > > +}
> > >
> > > I think we might need to have a frozenbytes object too.
> >
> > I believe YAGNI. Also, I'm not keen on all these frozen variants.
> > Hands up who's ever used a frozen set or needed a frozen dict?
>
> Tuples work for those, I think.

No, unless you sort the data; you'd have to say
tuple(sorted(d.items())) -- not pretty, and probably kind of slow.

> The use case I had in mind was a
> large mapping with binary data as the keys.  If there was no
> frozenbytes object then I guess the most memory efficient way of
> representing the keys would be to use unicode strings.  That's ugly.
> Is there some better way?

Have you ever encountered that use case in practice? (That's what I
meant by YAGNI. :-)

--
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-3000-checkins mailing list