From: Mat Schaffer Date: 2007-01-03T01:05:17+09:00 Subject: Re: Detecting default used in method calls On Jan 2, 2007, at 10:31 AM, Peter Lynch wrote: > I would like to know if a function has been called with or without an > optional argument. > > If I have - > > def the_Function (a, b = '') > end > > and I invoke it like this - > > the_Function('a') > the_Function('a', '') > > is there any way for me to tell within the_Function which form of > invocation was used? Not sure if there's something more graceful, but my first instinct would be to define it like def the_function(*args) ... end Then the function could contain the defaulting logic in the event of only one element in the args array. -Mat