From: Ned Konz Date: 2002-07-21T01:12:35+09:00 Subject: Re: valid hash keys On Saturday 20 July 2002 09:07 am, David Garamond wrote: > unlike perl, ruby treats 1 and '1' differently in hash keys: This is largely because: * Perl will happily change numbers to strings (and back), sometimes when you're least expecting it. * Perl only uses strings as hash keys. > so what are the range the valid values for hash keys? can i, like > in python, use "immutable lists"/tuples as hash keys? You can use any object. $ ri Object.hash ------------------------------------------------------------ Object#hash obj.hash -> aFixnum ------------------------------------------------------------------------ Generates a Fixnum hash value for this object. This function must have the property that a.eql?(b) implies a.hash == b.hash. The hash value is used by class Hash. Any hash value that exceeds the capacity of a Fixnum will be truncated before being used. -- Ned Konz http://bike-nomad.com GPG key ID: BEEA7EFE