Deutsch English Français Italiano |
<631f7757$0$5124$426a74cc@news.free.fr> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!news.mixmin.net!proxad.net!feeder1-2.proxad.net!cleanfeed1-a.proxad.net!nnrp1-1.free.fr!not-for-mail Date: Mon, 12 Sep 2022 20:15:51 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Newsgroups: fr.comp.lang.python Content-Language: fr From: ast <ast@invalid> Subject: del Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Lines: 22 Message-ID: <631f7757$0$5124$426a74cc@news.free.fr> Organization: Guest of ProXad - France NNTP-Posting-Date: 12 Sep 2022 20:15:51 CEST NNTP-Posting-Host: 91.170.32.5 X-Trace: 1663006551 news-2.free.fr 5124 91.170.32.5:10270 X-Complaints-To: abuse@proxad.net Bytes: 1120 bonjour >>> lst = [0, 1, 2] >>> del lst[:] >>> lst [] normalement lst[:] est une copie de lst, donc détruire lst[:] ne devrait pas modifier lst, or si, lst a été vidée. Pourquoi ? >>> lst = [0, 1, 2] >>> lst2 = lst[:] >>> del lst2 >>> lst [0, 1, 2] là c'est OK. Tout ce que j'ai fait est de donner un nom à lst[:]