> On Wed, 09 Feb 2005 17:42:41 -0800, [EMAIL PROTECTED]
> <[EMAIL PROTECTED]> wrote:
> > Update of /cvsroot/python/python/dist/src/Python
> > In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31172
> >
> > Modified Files:
> >         compile.c
> > Log Message:
> > Remove the set conversion which didn't work with:  [] in (0,)
> 
> Why is this a problem?  If there were *any* unhashable objects
> in the container, then the compiler would have bailed on the
> initial set-conversion.

>>> [] in frozenset(["hi", "ho"])
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: list objects are unhashable

The compiler do bail out when there are unhashable objects outside the
tuple, but not if the LHS is unhashable. I believe that is because
internally frozenset uses a dict and it does something similar to
d.has_key([]) in this case. It should be trivial for the compiler to
also check the LHS for hashability I think.

That is also why the email unit test failed - LHS was unhashable but
the RHS was hashable. There is a patch for that (1119016) at SF but
that may no longer be needed.
 
-- 
mvh Björn
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to