From: Robert Klemme Date: 2005-01-27T00:30:52+09:00 Subject: Re: Argument-per-argument Passing "Trans" schrieb im Newsbeitrag news:1106752384.371007.164750@f14g2000cwb.googlegroups.com... > This came up in an earlier thread. On occasion I run into situations > where I'd like to pass arguments from one method to another in an > "argument-per-argument" fashion. Take a look at the following: > > | def give > | return [:a,:b,:c] > | end > | > | def give_each > | return *[:a,:b,:c] > | end > | > | def take(*args) > | p *args > | end > | > | take(:a,:b,:c) > | :a > | :b > | :c > | > | take(give) > | [:a, :b, :c] > | > | take(give_each) > | [:a, :b, :c] > > I'm interested in the last exmple being like the first. I.e. > > | take(give_each) > | :a > | :b > | :c > > Which I am calling argument-per-argument passing. > What is the feasibility of this? How about take(*give) take(*give_each) Note also, that all your give* methods return the same. You can also do def give2 return :a,:b,:c end def give3 [:a,:b,:c] end Regards robert