Function Parameters

J

Joseph L. Casale

When you use optional named arguments in a function, how do you deal with with
the incorrect assignment when only some args are supplied?

If I do something like:

def my_func(self, **kwargs):

then handle the test cases with:

if not kwargs.get('some_key'):
raise SyntaxError
or:

if kwargs.get('some_key') and kwargs.get('another_key'):
...

I loose the introspection that some IDE's provide from the doc strings.

Any ideas on how to deal with this?

Thanks!
jlc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top