From: Robert Dober Date: 2008-08-18T22:50:32+09:00 Subject: Re: Hash#each vs Hash#each_pair On Mon, Aug 18, 2008 at 3:25 PM, Patrick Doyle wrote: > Sorry if this is a FAQ, but I'm curious to learn the rationale behind > having Hash#each be the same as Hash#each_pair instead of > Hash#each_value. > > For my own (self-interested) case, I would prefer that Hash#each and > Array#each both iterate through the values of the container. Hmm, your approach is making some sense, I however believe that Hash#each was chosen pragmatically and very reasonably so, I guess that Hash#each is the most used way to iterate over a hash and therefore it is quite convenient to have a *short* name. I also believe that #each shall mean "each" and keys being part of the hash, yielding the keys and the values makes sense too. HTH Robert > > So, why are these different? > > --wpd > > -- http://ruby-smalltalk.blogspot.com/ There's no one thing that's true. It's all true. -- Ernest Hemingway