Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #98815

Re: Persist objects in a LIST

From Vincent Vande Vyvre <vincent.vande.vyvre@telenet.be>
Newsgroups comp.lang.python
Subject Re: Persist objects in a LIST
Date 2015-11-14 17:33 +0100
Message-ID <mailman.331.1447519455.16136.python-list@python.org> (permalink)
References <0cb1bcda-54d5-4cc7-bd23-f86f7f10ee28@googlegroups.com> <15f9fdeb-f4b4-4404-bccb-2e67a26035ed@googlegroups.com> <sale4b1mf366fhioarhastvbksjf0c9hfb@4ax.com>

Show all headers | View raw


Le 14/11/2015 16:39, Dennis Lee Bieber a écrit :
> On Sat, 14 Nov 2015 07:02:41 -0800 (PST), John Zhao <johnzzhao@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

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Persist objects in a  LIST John Zhao <johnzzhao@gmail.com> - 2015-11-14 06:26 -0800
  Re: Persist objects in a  LIST John Zhao <johnzzhao@gmail.com> - 2015-11-14 07:02 -0800
    Re: Persist objects in a  LIST Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-11-14 10:39 -0500
    Re: Persist objects in a LIST Vincent Vande Vyvre <vincent.vande.vyvre@telenet.be> - 2015-11-14 17:33 +0100

csiph-web