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
> > the 2nd argument?
>
>The most common solution I've seen is to write wrappers
>around the basic function like:
>
>def fullFact(n, precision=15):
>     return fact(n,True,precision)
>
>def precisionFact(n, full=False):
>     return fact(n, full, 15)
>
>Not terribly elegant but is at least short and simple.

Alan, I won't adopt this solution for my fact(), but I'm glad to know about it.

Thanks,

Dick


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to