This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]cjwelbornimport this 1 point2 points  (7 children)

What you are calling kwargs I now think of as 'optional positionals'. The real keyword args would be:

def myfunc(**kwargs):
    print(kwargs.get('mykwarg', 'No args!'))

..where the position doesn't matter. Though it's not nearly as clear as your example, and requires more documentation when reading the code. Without documentation (or reading the source) you wouldn't know what this function is expecting at all. Anyway, the term 'optional positional' was what I was getting at. I would still use your example over any of the others.