From: Leo Laursen <1858323m001@...1.stofanet.dk> Date: 2001-12-12T00:42:15+09:00 Subject: [ruby-talk:28232] Re: Hash.keys Q Den 12-12 2001 kl. 12:21:38 +0900, skrev David Alan Black: > Welcome to Ruby! Thank you >> Now options.keys returns ["Password", "Host", "Port", "Name"] >> I would expect ["Host", "Port", "Name", "Password"] >> is there an explanation for this ? > Yes: the order of hash keys is not guaranteed. I *think* #keys > returns the keys in the same order when called multiple times, but I'm > not 100% sure. In any case, that order itself cannot be predicted. The order has been consistent so far. I wonder if the order is dependent of the hash content, or host specific. > I believe various people have written various OrderedHash > extensions... (very helpful advice, I know :-) You could search on > to see if there's been discussion here. I'll have a look, thanks Leo -- Non-Determinism is not meant to be reasonable. -- M.J. 0'Donnell