From: Hal Fulton Date: 2004-04-24T13:21:24+09:00 Subject: Re: Array to Hash Pe�a, Botp wrote: > Finally, I got it (dug the archives).. > > >>>h2 = Hash[*a] > > => {["x", 1]=>["y", 3]} > > But, it looks weird. No, not just the cryptic Hash*a, but the result as > well. I do not see any use of the result. > > I would rather prefer: > > >>>h2 = a.to_hash # or a.to_h > > {"x"=>1, "y"=>3} > > Seems no brainer if that's the case. > Is there any reason why not? Well, legacy code expects a flat array of pairs... so Hash(*(a.flatten)) should work for you. But changing the way that works could break others' code. Yet it does seem odd that Hash.to_a doesn't return a form that Hash[*a] can use as-is. Hal