A quick Python kwargs quiz

Here’s some sample code:

def printargs(**kwargs):
  print kwargs

printargs(foo='bar')
printargs(**dict(foo='bar'))
printargs(**{'foo':'bar'})

Today’s question is:  In what way are the 3 bottom lines different with respect to their behavior?

This entry was posted in General. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>