Dictionary Enhancement?

Emile van Sebille emile at fenx.com
Thu Oct 31 15:56:04 CET 2002


Rich Harkins
> I was wondering if anyone else had been wanting to enhance Python
> dictionaries 

Like this?
>>> d = {}
>>> d.setdefault('key','value')
'value'
>>> d
{'key': 'value'}
>>> d['key']='new value'
>>> d.setdefault('key','value')
'new value'
>>> d
{'key': 'new value'}
>>>

--

Emile van Sebille
emile at fenx.com

---------







More information about the Python-list mailing list