Path: ...!weretis.net!feeder6.news.weretis.net!feeder8.news.weretis.net!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!cleanfeed3-a.proxad.net!nnrp4-2.free.fr!not-for-mail Date: Fri, 5 Nov 2021 10:28:45 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Thunderbird/91.3.0 Subject: Re: Syntaxe pas comprise Content-Language: fr Newsgroups: fr.comp.lang.python References: <6183d5e8$0$1344$426a74cc@news.free.fr> <87o86zhohs.fsf@izac.org> From: ast In-Reply-To: <87o86zhohs.fsf@izac.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Lines: 21 Message-ID: <6184f94c$0$6462$426a74cc@news.free.fr> Organization: Guest of ProXad - France NNTP-Posting-Date: 05 Nov 2021 10:28:44 CET NNTP-Posting-Host: 91.170.32.5 X-Trace: 1636104524 news-1.free.fr 6462 91.170.32.5:11426 X-Complaints-To: abuse@proxad.net Bytes: 1538 Le 04/11/2021 à 17:30, Benoit Izac a écrit : >> >> x, y = 1 génère une erreur >> x, y = (i for i in range(10)) aussi > > Mais c'est normal, dans le premier cas il n'y a pas assez d'objets, dans > le second il y en a trop. > oui Comme il y avait 2 variables à gauche du =, j'attendais 2 objects à droite, comme dans: x, y = 8, 9 Mais si il y un seul object itérable à droite du = qui fournit le bon nombre de données, ça marche aussi, comme dans: x, y = (i for i in range(2))