Testing for presence of arguments

Madhusudan Singh spammers-go-here at spam.invalid
Wed Aug 17 12:09:42 EDT 2005


Peter Decker wrote:

> On 8/17/05, Madhusudan Singh <spammers-go-here at spam.invalid> 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 ?
>> 
>> My required functionality depends on whether a certain argument is
>> specified at all. (Setting default values is *not* good enough.).
> 
> Could you just write the function as:
> 
> myFunc(*args, **kwargs):
> 
> ...and then figure out what was passed?
> 

Seems a lot simpler than the other module suggestion, but another person has
posted a suggestion that is a lot more quick and elegant. Thanks anyways. I
might find this useful in some as yet unknown context.



More information about the Python-list mailing list