[Python-Dev] PEP 351, the freeze protocol
Josiah Carlson
jcarlson at uci.edu
Mon Oct 24 12:15:17 CEST 2005
Christopher Armstrong <radeex at gmail.com> wrote:
>
> On 10/24/05, Josiah Carlson <jcarlson at uci.edu> wrote:
> > "Should dicts and sets automatically freeze their mutable keys?"
> >
> > Dictionaries don't have mutable keys,
>
> Since when?
>
> Maybe you meant something else? I can't think of any way in which
> "dictionaries don't have mutable keys" is true. The only rule about
> dictionary keys that I know of is that they need to be hashable and
> need to be comparable with the equality operator.
Good point, I forgot about user-defined classes (I rarely use them as
keys myself, it's all too easy to make a mutable whose hash is dependant
on mutable contents, as having an object which you can only find if you
have the exact object is not quite as useful I generally need). I will,
however, stand by, "a container which is frozen should have its contents
frozen as well."
- Josiah
More information about the Python-Dev
mailing list