From: nobu.nokada@... Date: 2005-04-25T08:04:28+09:00 Subject: Re: Suggestion: Hash.remove Hi, At Mon, 25 Apr 2005 04:44:32 +0900, Florian Gro� wrote in [ruby-talk:139655]: > >>>>>Perhaps you could instead change your proposal to make .delete() accept > >>>>>multiple keys? > >>> > >>>What will be returned? > >> > >>An Array of the deleted values? > > > > It's not compatible obviously. Another method Hash#remove (and > > Array#remove also?) sounds better, I guess. > > Oh, I don't think so. There is other methods which also return an Array > or one value depending on their arguments. Array#last comes to mind. It differs from this. array.last => obj or nil array.last(n) => an_array Array#last doesn't allow arbitrary number arguments, but just 0 or 1. Consider: array = [...] deleted = hash.delete(*array) `deleted' will be an element if array's size equals 1, or an array otherwise. It sounds like a pitfall. -- Nobu Nakada