Re: [Tutor] Problem with default arguments for function

2007-11-12 Thread Alan Gauld
"Dick Moores" <[EMAIL PROTECTED]> wrote >>Another typical strategy is to use some prescribed special value for >>the precision parameter to designate the desire for full precision. > > Beautiful! Thanks! It seems I misunderstood your question. I thought you were referring to the general pr

Re: [Tutor] Problem with default arguments for function

2007-11-11 Thread Dick Moores
At 05:10 PM 11/11/2007, Michael H. Goldwasser wrote: >Dick, > >Another typical strategy is to use some prescribed special value for >the precision parameter to designate the desire for full precision. >For example, since precisions should presumably be positive, one could >design this function as

Re: [Tutor] Problem with default arguments for function

2007-11-11 Thread Dick Moores
At 05:38 PM 11/11/2007, Kent Johnson wrote: >Dick Moores wrote: > >>def fact(n, precision=15, full=False): > ... > >># 3 (full set to True, forcing precision to be specified--but >>irrelevant what it is set to) >> >>> print fact(50, 3, True) >>304140932017133780436126081660647688443776415689605

Re: [Tutor] Problem with default arguments for function

2007-11-11 Thread Dick Moores
At 04:22 PM 11/11/2007, Alan Gauld wrote: >"Dick Moores" <[EMAIL PROTECTED]> wrote > > > And if the function is rewritten as def fact(n, full=False, > > precision=15) > > there would be the analogous problem involving full. > > > > Is there a way to solve this problem of the unnecessary setting of

Re: [Tutor] Problem with default arguments for function

2007-11-11 Thread Kent Johnson
Dick Moores wrote: > def fact(n, precision=15, full=False): ... > # 3 (full set to True, forcing precision to be specified--but > irrelevant what it is set to) > >>> print fact(50, 3, True) > 30414093201713378043612608166064768844377641568960512 You don't have to specify precisi

Re: [Tutor] Problem with default arguments for function

2007-11-11 Thread Alan Gauld
"Dick Moores" <[EMAIL PROTECTED]> wrote > And if the function is rewritten as def fact(n, full=False, > precision=15) > there would be the analogous problem involving full. > > Is there a way to solve this problem of the unnecessary setting of > the 2nd argument? The most common solution I've s