On 8 Nov 2005 01:12:07 -0800, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>I knew there was an easy way :)
>
>Just to satisfy my curiousity: Is there a way to do something like the
>reference solution I suggest above?
>
If the last element in the list was a dict, then you could do something like
>>> lst = ['the', 'last', 'element of this list is a dict', {'key':"key's
>>> value"}]
>>> ref = lst[-1]
>>> ref
{'key': "key's value"}
>>> ref["foo"] =42
>>> ref['bar'] = 'Ni!'
>>> ref
{'foo': 42, 'bar': 'Ni!', 'key': "key's value"}
>>> ref['key']
"key's value"
>>> ref['bar']
'Ni!'
>>> del ref['key']
>>> ref
{'foo': 42, 'bar': 'Ni!'}
FWIW ;-)
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list