Christoph Zwerschke <[EMAIL PROTECTED]> writes:
> As a general note, I think it would be good to place the exact
> description in a footnote, since speaking about hashable objects,
> __hash__ and __cmp__ will certainly frighten off newbies and make it
> hard to read even for experienced users. The main text may
> lie/simplyfy a little bit.
Good point.
> However, since the Python docs are a reference and not a textbook or
> manual, I think the debt should not be payed back "later", but
> immediately in a footnote.
Ok, how about this for dictionaries/sets:
Any hashable object can be used as a dictionary key (set member). Immutable
objects, except for tuples that contain a non-hashable object, are
hashable. Python classes are normally hashable(1).
And the footnote is:
Instances of Python classes are hashable if they define a __hash__
method, or if they don't define either __cmp__ or __eq__.
<mike
--
Mike Meyer <[EMAIL PROTECTED]> http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
--
http://mail.python.org/mailman/listinfo/python-list