Nick Vatamaniuc wrote:
> Robert Kern wrote:
> > [EMAIL PROTECTED] wrote:
> > > The same thing goes for the values(). Here most people will argue that
...
> >
> > This part is pretty much a non-starter. Not all Python objects are hashable.
...
> > Also, I may need keys to map to different objects that happen to be equal.
> >
> > --
> > Robert Kern
> >


So, values() can't return a set because of (at least) the two reasons
given above.  And since, as Scott David Daniels pointed out, dicts
support the iterator protocol, you can ask for a set of the keys easily
enough if you want it:

>>> d = dict(a=1, b=2, c=3)
>>> set(d)
set(['a', 'c', 'b'])

So, IMHO, there's not much point to having keys() return a set.


Peace,
~Simon

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to