From: Brian Candler Date: 2007-05-04T02:40:20+09:00 Subject: Re: Beyond YAML? (scaling) On Fri, May 04, 2007 at 01:25:05AM +0900, Bil Kleb wrote: > Bil Kleb wrote: > > > > Hash.new{ |hash,key| hash[key]=[] } > > Is there a better way than, > > samples[tag] = [] unless samples.has_key? tag > samples[tag] << sample Not exactly identical but usually good enough: samples[tag] ||= [] samples[tag] << sample And you can probably combine: (samples[tag] ||= []) << sample