Benji York wrote:

> Madhusudan Singh wrote:
>> I know how to set optional arguments in the function definition. Is there
>> an intrinsic function that determines if a certain argument was actually
>> passed ? Like the fortran 95 present() logical intrinsic ?
> 
> People generally use a value that isn't a valid option, often None.
> 
> def my_func(a, b, c=None):
>      if c is None:
>          do something
> 
> If None is a valid value, make one that isn't:
> 
> unspecified = object()
> 
> def my_func(a, b, c=unspecified):
>      if c is unspecified:
>          do something
> --
> Benji York

Now, that was a very good suggestion. Thanks.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to