Re: lambda

From: Steve Holden (steve_at_holdenweb.com)
Date: 01/17/05


Date: Mon, 17 Jan 2005 07:21:16 -0500

Antoon Pardon wrote:

> Op 2005-01-17, Steve Holden schreef <steve@holdenweb.com>:
>
>>Antoon Pardon wrote:
>>[...]
>>
>>>>"A foolish consistency is the hobgoblin of little minds". Rules are made
>>>>to be broken.
>>>
>>>
>>>Like only use immutables as dictionary keys.
>>>
>>
>>Fair enough, but don;t go advising newbies to do this.
>
>
> How about something like this.
>
> Because of the extra precautions one has to take when
> using mutables as hash keys, we advise newbies
> to stick with immutable keys until they have gathered
> enough knowledge and experience to adequatly weight
> the pro and cons of a mutable key solution against
> an immutable key solution.
>
There you go with the minutiae again. How about:

"Don't use mutables as hash keys"?

regards
  Steve

-- 
Steve Holden               http://www.holdenweb.com/
Python Web Programming  http://pydish.holdenweb.com/
Holden Web LLC      +1 703 861 4237  +1 800 494 3119


Relevant Pages

  • Re: lambda
    ... > to construct immutable keys for actual use, ... >>providing these same dictionaries with those semantics to the users ... I have seen defenders of only immutables as keys, ... the argument that using mutables as keys would require a copy of the key. ...
    (comp.lang.python)
  • Re: Why are tuples immutable?
    ... I just find that countering such bugs by requiring keys to be ... they should acertain themselves not to mutate such objects while they ... But that problem is not limited to dictionaries. ... to use mutables as keys. ...
    (comp.lang.python)
  • Re: lambda
    ... >> to stick with immutable keys until they have gathered ... The problem with mutables as dictionary ... I don't see a big difference between these principles ... Antoon Pardon ...
    (comp.lang.python)
  • Re: Why are tuples immutable?
    ... >>Demanding that users of dictioanaries somehow turn their mutable objects ... >>into tuples when used as a key and back again when you retrieve the keys ... in the second we just allow mutables to ... Now in scenario one we will have a lot more copies then in scenario ...
    (comp.lang.python)
  • Re: lambda
    ... > using mutables as hash keys, ... > to stick with immutable keys until they have gathered ... > the pro and cons of a mutable key solution against ... Una buena gran parte del arte del bien hablar consiste en saber mentir con ...
    (comp.lang.python)

Loading