Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

C is quirky, flawed, and an enormous success -- Dennis M. Ritchie


devel / comp.lang.python / Re: If a dictionary key has a Python list as its value!

SubjectAuthor
o Re: If a dictionary key has a Python list as its value!MRAB

1
Re: If a dictionary key has a Python list as its value!

<mailman.60.1709836015.3452.python-list@python.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=29611&group=comp.lang.python#29611

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: python@mrabarnett.plus.com (MRAB)
Newsgroups: comp.lang.python
Subject: Re: If a dictionary key has a Python list as its value!
Date: Thu, 7 Mar 2024 18:23:46 +0000
Lines: 24
Message-ID: <mailman.60.1709836015.3452.python-list@python.org>
References: <CAKW-c0x7-r_HtTkb0NdhQx7_Yo1fSfGdvOqBOcq_LdoSYdt57Q@mail.gmail.com>
<a0cc1083-5f2e-452d-8817-61fdf1235d4e@mrabarnett.plus.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de 6f9/0mZ2j1m8kE/BUWTI7w+rPvPgNo7Hp1+hJaNHIrRA==
Cancel-Lock: sha1:iAktG42L7uaVti9USHGSFocQLGU= sha256:UfC6Yc3juiisRXeG5icDkMRbXsfLgI0iMulE1YyqQTw=
Return-Path: <python@mrabarnett.plus.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=plus.com header.i=@plus.com header.b=b63Ynldg;
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.001
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'explanation': 0.07;
'string': 0.07; 'subject:value': 0.07; 'from:addr:python': 0.09;
'received:192.168.1.64': 0.09; 'string,': 0.09; 'subject:list':
0.11; 'subject:Python': 0.12; 'tutorial': 0.12; 'following.':
0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:name:mrab':
0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'received:84.93':
0.16; 'received:84.93.230': 0.16; 'received:84.93.230.227': 0.16;
'received:plus.net': 0.16; 'wrote:': 0.16; 'python': 0.16;
'values': 0.17; 'to:addr:python-list': 0.20; 'tutorials': 0.23;
'list,': 0.24; 'expect': 0.28; 'header:User-Agent:1': 0.30;
'python-list': 0.32; 'received:192.168.1': 0.32; 'header:In-Reply-
To:1': 0.34; 'using': 0.37; "it's": 0.37; 'received:192.168':
0.37; 'read': 0.38; 'this,': 0.39; 'mentioned': 0.39; 'list':
0.39; 'on.': 0.39; "you'd": 0.64; 'key': 0.64; 'number,': 0.64;
'subject:!': 0.76
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=plus.com; s=042019;
t=1709835827; bh=CNwt4t43fJMNUUzWJNCOqmF5Gkv6JbBNqvbvdJkcw2c=;
h=Date:Subject:To:References:From:In-Reply-To;
b=b63Ynldg26/NxrtlWsDgBtUgpR1aZA76cY5hM8+HV+GjAvTZpz1ek+aKxnE/UNrTS
ec31rbJkZDw5i6dduqSrPfQf65M6V08WVATghesvS3MZfiiH0Imf2HwPxkM4WHduPi
Nhi6okEYSZ724fMwPZQ2n9Cs7rpcBBj2juJPTu921tMpMAh0Jg93smcTqMzCschIOQ
29ve0J2DY+8SbLzlUBFUMJOfa0zKIXnUJddg468jrjrUIIqBANN+wNiQ6OJE6i465Q
rFTIWcIC3icNtq9NN0UPS4SCskCEIMJuR5fJHMv7Wo0EWJqd8BKSfGqPRdOx8tiKrx
Haum6Y8IAFpSA==
X-Clacks-Overhead: "GNU Terry Pratchett"
X-CM-Score: 0.00
X-CNFS-Analysis: v=2.4 cv=Q4Rx4J2a c=1 sm=1 tr=0 ts=65ea0633
a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17
a=IkcTkHD0fZMA:10 a=-A8d3aQp1jITHW-f3cMA:9 a=QEXdDO2ut3YA:10
X-AUTH: mrabarnett@:2500
User-Agent: Mozilla Thunderbird
Content-Language: en-GB
In-Reply-To: <CAKW-c0x7-r_HtTkb0NdhQx7_Yo1fSfGdvOqBOcq_LdoSYdt57Q@mail.gmail.com>
X-CMAE-Envelope: MS4xfGjJnfFgsCy0buGuCTSb1Cdw7R1Muhj6TpTfPjLjCo43PyRiVsJIEFF3SyscfvlEEUP29OkckThHNMsb3zXBpIaS7qVt/gIcDkDLY2Ti08B94vrc4K84
7dhrm3Dib3syTIg6i9bVydZJIPFhdgvo9EtDYtIg7EmyMTCtzbaK1y9M8JAPWFpMvWExdvDM4JlU/45GrmC+Qsikib/7lMZObsY=
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <a0cc1083-5f2e-452d-8817-61fdf1235d4e@mrabarnett.plus.com>
X-Mailman-Original-References: <CAKW-c0x7-r_HtTkb0NdhQx7_Yo1fSfGdvOqBOcq_LdoSYdt57Q@mail.gmail.com>
 by: MRAB - Thu, 7 Mar 2024 18:23 UTC

On 2024-03-07 14:11, Varuna Seneviratna via Python-list wrote:
> If a dictionary key has a Python list as its value, you can read the values
> one by one in the list using a for-loop like in the following.
>
> d = {k: [1,2,3]}
>
>
>> for v in d[k]:
>> print(v)
>
>
> No tutorial describes this, why?
> What is the Python explanation for this behaviour?
>
If the value is a list, you can do list things to it.

If the value is a number, you can do number things to it.

If the value is a string, you can do string things to it.

And so on.

It's not mentioned in tutorials because it's not special. It just
behaves how you'd expect it to behave.

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor