[Tutor] Problem with default arguments for function

Dick Moores rdm at rcblue.com
Mon Nov 12 04:05:37 CET 2007


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)
>>30414093201713378043612608166064768844377641568960512000000000000
>
>You don't have to specify precision if you pass full as a keyword argument:
>fact(50, full=True)

Ah, good to know. Thanks.

Dick




More information about the Tutor mailing list