a clean way to define dictionary

Sean 'Shaleh' Perry shalehperry at attbi.com
Wed Jun 18 02:58:38 EDT 2003


On Tuesday 17 June 2003 21:35, Kendear wrote:
>
> or is there a more common way to define a dictionary
> without all the punctuation marks?

>>> def make_dict(**kwargs):
...     return kwargs
... 
>>> make_dict(foo=1, bar='sean')
{'foo': 1, 'bar': 'sean'}

is the most common form I have seen.  Not sure if it works for you.






More information about the Python-list mailing list