[Tutor] Problem with default arguments for function

Kent Johnson kent37 at tds.net
Mon Nov 12 02:38:27 CET 2007


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)
> 30414093201713378043612608166064768844377641568960512000000000000

You don't have to specify precision if you pass full as a keyword argument:
fact(50, full=True)

Kent


More information about the Tutor mailing list