From: paron Date: 2009-06-12T23:30:13+09:00 Subject: Re: Idiomatic way to detect first/last iteration? On Jun 12, 8:41 am, Gary Wright wrote: > On Jun 12, 2009, at 7:45 AM, paron wrote: > > >  first_record=records.shift > >  last_record=records.pop > > You can't use 'shift' and 'pop' if you want the > solution to work with *any* enumerable object. > > It just depends how general a solution you are > looking for. Good point; I'd forgotten that case. There's really no inherently meaningful "first" or "last" with a Hash, so I ignored it. In fact, couldn't you consider "first" and "last" meaningless for any Enumerable that isn't indexed? Maybe the question shouldn't be about Enumerable. Anyway, good catch. Ron