Warning: mysqli::__construct(): (HY000/1203): User howardkn already has more than 'max_user_connections' active connections in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\includes\artfuncs.php on line 21
Failed to connect to MySQL: (1203) User howardkn already has more than 'max_user_connections' active connections
Warning: mysqli::query(): Couldn't fetch mysqli in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\index.php on line 66
Article <utrvj4$1440d$1@dont-email.me>
Deutsch   English   Français   Italiano  
<utrvj4$1440d$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: "Michael F. Stemper" <michael.stemper@gmail.com>
Newsgroups: comp.lang.python
Subject: Re: Popping key causes dict derived from object to revert to object
Date: Mon, 25 Mar 2024 08:52:36 -0500
Organization: A noiseless patient Spider
Lines: 35
Message-ID: <utrvj4$1440d$1@dont-email.me>
References: <87zfurgb6t.fsf@zedat.fu-berlin.de> <uti7n1$2ef92$1@dont-email.me>
 <87plvmr93v.fsf@zedat.fu-berlin.de> <4V1Rrq72BnznWJ6@mail.python.org>
 <mailman.13.1711123277.3468.python-list@python.org>
 <87zfumre9b.fsf@zedat.fu-berlin.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 25 Mar 2024 14:52:37 +0100 (CET)
Injection-Info: dont-email.me; posting-host="86318455a6a084657f7e1558145f30ed";
	logging-data="1183757"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/uKDmvcv3ulvBkk73xly8qi/7n5z+noSw="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
 Thunderbird/102.11.0
Cancel-Lock: sha1:qlrF2DItX5jCohufGISjsoufxFI=
In-Reply-To: <87zfumre9b.fsf@zedat.fu-berlin.de>
Content-Language: en-US
Bytes: 2368

On 25/03/2024 01.56, Loris Bennett wrote:
> Grant Edwards <grant.b.edwards@gmail.com> writes:
> 
>> On 2024-03-22, Loris Bennett via Python-list <python-list@python.org> wrote:
>>
>>> Yes, I was mistakenly thinking that the popping the element would
>>> leave me with the dict minus the popped key-value pair.
>>
>> It does.
> 
> Indeed, but I was thinking in the context of
> 
>    dict_list = [d.pop('a') for d in dict_list]
> 
> and incorrectly expecting to get a list of 'd' without key 'a', instead
> of a list of the 'd['a]'.
I apologize if this has already been mentioned in this thread, but are
you aware of "d.keys()" and "d.values"?

  >>> d = {}
  >>> d['do'] = 'a deer, a female deer'
  >>> d['re'] = 'a drop of golden sunshine'
  >>> d['mi'] = 'a name I call myself'
  >>> d['fa'] = 'a long, long way to run'
  >>> d.keys()
  ['fa', 'mi', 'do', 're']
  >>> d.values()
  ['a long, long way to run', 'a name I call myself', 'a deer, a female deer', 'a drop of golden sunshine']
  >>>


-- 
Michael F. Stemper
Exodus 22:21