No-brainer? Dictionary keys to variable name?

Mark McEahern marklists at mceahern.com
Fri Aug 2 18:31:28 CEST 2002


[Steve Holden]
> Perhaps I'm missing something, but with keyword arguments
> providing default values, doesn't this get everything the OP wanted?

Not as far as I can tell.  The OP wants to define the func without
specifying the arguments:

  def foo(**kwargs)

AND call the func with a dict:

  foo(**theDict)

AND presumably not have to initialize default values.

Talk about having your cake and eating it too, eh?

// m

-





More information about the Python-list mailing list