Antoon Pardon apardon at
Tue Jan 18 09:39:32 EST 2005

Op 2005-01-18, Steve Holden schreef <steve at>:
> Antoon Pardon wrote:
>> Op 2005-01-18, Nick Coghlan schreef <ncoghlan at>:
> [...]
>> But don't use mutable keys is not a general principle. It is a principle
>> introduced by the limitations of the python implementations.
> Sorry, but it *is* a general principle, adduced from the potential 
> pitfalls available to inexperienced programmers when breaking the principle.

But if these inexperienced programmers would have used dictionaries
that were implemented more safely, those pitfalls would have been
avoided. So are the pitfalls caused by breaking the principle
or by using an unsafe dictionary implementation?

>> I don't like it when a good rule of thumb because of implementation
>> limitations is sold as a general principle.
> So, since you are so good at nit-picking, perhaps you will explain the 
> difference between "rule of thumb" and "general principle".

A rule of thumb is context sensitive. If circumstances change,
so do the rules of thumb. Principles have a broader field
of application.

IMO there is nothing principally wrong with using a mutable object
as a dictionary key. But avoiding doing so is a good rule of
thumb if you have a python-like implementation of a dictionary.

Antoon Pardon

More information about the Python-list mailing list