[Python-3000] callable()

Stefan Behnel behnel_ml at gkec.informatik.tu-darmstadt.de
Wed Jul 26 05:47:47 CEST 2006


Collin Winter wrote:
> On 7/25/06, Andrew Koenig <ark-mlist at att.net> wrote:
>>> With your CD example, you need an external resource (the CD itself) in
>>> order to calculate the hash - in that case, you can't safely defer
>>> the hash calculation until the first time you know you need it,
>>> since you don't know whether or not you'll have access to the
>>> physical CD at that point.
>> OK.  Then instead of a CD, use a (read-only) disk file.  The example is
>> still valid in that case, and avoids the extraneous matter of operator
>> intervention.
> 
> Oh, please. No-one's arguing that hashes MUST be fast to compute; it's
> just a good rule of thumb. There will of course be exceptional cases,
> like the contrived examples you've come up with, but they're just
> that: exceptional. If you find yourself writing classes that must hash
> a large on-disk file or CD or whatever else, you can add custom tests
> for hashability yourself. There's no need to clutter the language to
> cater to every odd corner case someone digs up.

Very well said and I couldn't agree more.

+1 for not adding hashable() to the language.

Stefan



More information about the Python-3000 mailing list