From: Kristof Bastiaensen Date: 2004-08-08T18:56:30+09:00 Subject: Re: Sets are not extensional On Sun, 08 Aug 2004 05:26:15 +0000, Reimer Behrends wrote: > Kristof Bastiaensen (kristof@vleeuwen.org) wrote: [...] >> As far as I know, hash.to_a always generates the same array. > > No. Hash#to_a will generate the same array for the same hash object, but > for different hash objects with equal keys and values, it will not. Same > for Hash#keys and Hash#values (Set#to_a is based on Hash#keys). > > You are correct. I had tested it with small Hashes ({1 => 2, 2 => 1}), but of course in large Hashes objects which fall in the same bucket can appear on different positions as you said. Perhaps the best solution is to recalculate the Hashvalue each time (as Robert Klemme proposed). Thanks, KB