Le 14/11/2015 16:39, Dennis Lee Bieber a écrit :
On Sat, 14 Nov 2015 07:02:41 -0800 (PST), John Zhao <johnzz...@gmail.com>
declaimed the following:

I found a solution.  replace  bDict.clear() with  bDict = {}

        Which is creating a second, empty, dictionary and binding the name
"bDict" to that new one.

        If all you want is to get rid of the name

                del bDict

should suffice.
Not exactly.

>>> l = []
>>> d = {'key': 'val'}
>>> l.append(d)
>>> l
[{'key': 'val'}]
>>> del d
>>> l
[{'key': 'val'}]
>>> del l[0]
>>> l
[]
>>>

Vince
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to