[Israel.pm] Python talk

Omer Zak omerz at actcom.co.il
Wed Dec 8 02:37:13 PST 2004


On Tue, 7 Dec 2004, Mikhael Goikhman wrote:

> Are you sure the keys of your COMPLICATED_ASSOC_ARRAY may be associative
> arrays by themselves? Python gives me an arror when I try to do this.
> It seems that the keys of the Python "hash" can be "arrays", but not
> "hashes". So, your statement above is not true.

I did not use associative arrays as keys in the example, as you realized
some time later.

Normally, it is not possible to use them as keys because they are mutable.
However, it is possible to wrap them in a class, which forces them to be
immutable and defines hash and equality functions.  Once this has been
done, instances of this class can be used as keys.

                                             --- Omer
My opinions, as expressed in this E-mail message, are mine alone.
They do not represent the official policy of any organization with which
I may be affiliated in any way.
WARNING TO SPAMMERS:  at http://www.zak.co.il/spamwarning.html




More information about the Perl mailing list