Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"When the going gets weird, the weird turn pro..." -- Hunter S. Thompson


devel / comp.lang.python / Re: Why no list as dict key?

SubjectAuthor
* Why no list as dict key?Abdur-Rahmaan Janhangeer
`- Re: Why no list as dict key?Greg Ewing

1
Why no list as dict key?

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

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: arj.pyt...@gmail.com (Abdur-Rahmaan Janhangeer)
Newsgroups: comp.lang.python
Subject: Why no list as dict key?
Date: Wed, 20 Apr 2022 22:22:04 +0400
Lines: 12
Message-ID: <mailman.168.1650478937.20749.python-list@python.org>
References: <CADrxXXmWEjmQmR0-mP7tugrEJ1YhqBCt_X-57fumqft4=rNPYw@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: news.uni-berlin.de k1JN42LMo4sagtI36gpL5w6zNKcGZqMJXd7a+I7ZES6w==
Return-Path: <arj.python@gmail.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=gmail.com header.i=@gmail.com header.b=nq3XJBx5;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.001
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'url-ip:140.82.114/24':
0.03; 'url-ip:140.82/16': 0.03; 'subject:Why': 0.07; 'so?': 0.09;
'subject:list': 0.11; 'url:github': 0.14; 'url-ip:140/8': 0.15;
'dictionary.': 0.16; 'from:addr:arj.python': 0.16; 'from:name
:abdur-rahmaan janhangeer': 0.16; 'janhangeer': 0.16; 'mauritius':
0.16; 'github': 0.17; 'to:addr:python-list': 0.20; 'list,': 0.24;
'cannot': 0.25; 'url-ip:51/8': 0.26; 'blog': 0.30;
'to:name:python': 0.32; 'message-id:@mail.gmail.com': 0.32;
'received:google.com': 0.34; 'from:addr:gmail.com': 0.35; 'using':
0.37; 'received:209.85': 0.37; 'thanks': 0.38; 'received:209':
0.39; 'received:209.85.208': 0.39; 'list': 0.39; 'key': 0.64
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
h=mime-version:from:date:message-id:subject:to;
bh=ynxyAar+xr1gKOahVrqUns15ASzl4nocOkxIhLJcs7s=;
b=nq3XJBx5DP7+0SW7sp7GxeL2aatao1pYs7waht5doQJg1Elq5FWGhxslrBkJ/vp9od
bkm96QEmolOBHHTRT3SOEQs7RxrSr9vgoMpho6Ig9FIZ61mWOXSSBPwDGNERF2wsqGBv
U4Iui0BWJSc4tqdBgJAVSdQye/furKe9uH5zsmRQGitYAKn0U6coKzVDovUTg5djqdAE
XEPDUy2vQS+TpsPuXs0g7VePC7LNsg/DwcimMJbV8uQvmfw5miO/9zqHWnGW8gOCM16u
Lzimp/gR1ChzALP5VaUaiieTKVI5i0MLY0tXkR59bCzSZuli/RAC3nY2uWkJAUeGV1oR
UAdw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:mime-version:from:date:message-id:subject:to;
bh=ynxyAar+xr1gKOahVrqUns15ASzl4nocOkxIhLJcs7s=;
b=apDvchKQHWShrKiedR7OO0jhokoqi+IYVxkNhMAPjr6nSR5fsoFcn17AOsW0z6HrrH
2wvNPyyB5TWSlJoYqOdyOWuWQEsAql75FAhQNtd6pU8q3vNI2+3CnCSon/FP4HVfqWOt
tMIrpICyoPjyl3YowEO0UmZ7+B+xLh09nEQUDYMV4gAYIQMxvtmCiP8OjiAzde9xfyE6
hkszGw7F/Q9mr3DjKB21pVzJw3ID9tuissjqg1Pq59ZA5kVb2tJNaGZ9xz+7Uh3/yBy6
6hFSejUkCOjNUsd4GTYm0XoIWo8icDC/Z/n1Tt8zM5MTbGBJQadcWdNsZb0bWH4guPWg
WN7g==
X-Gm-Message-State: AOAM53318O9XNaZobfg0+4888CjcbNpX9bNsKJwtqFiB2BUAT9ndIfIR
cbsYUhmU8l1jh50BGZe7+kkT5JkB4+shNw8jrz04RzQQLQY=
X-Google-Smtp-Source: ABdhPJymB7iHH2JDqbojFeSOal2pUhBX7rWUaL3yAZLK+1Az/thSBWbV50vRzyBjIcjXAx14oKu5cQkhobW26ksNHSM=
X-Received: by 2002:a2e:a4ca:0:b0:24d:aad3:79bc with SMTP id
p10-20020a2ea4ca000000b0024daad379bcmr13957578ljm.446.1650478935493; Wed, 20
Apr 2022 11:22:15 -0700 (PDT)
X-Content-Filtered-By: Mailman/MimeDel 2.1.39
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: <CADrxXXmWEjmQmR0-mP7tugrEJ1YhqBCt_X-57fumqft4=rNPYw@mail.gmail.com>
 by: Abdur-Rahmaan Janhan - Wed, 20 Apr 2022 18:22 UTC

Greetings list,

Using Python3.9, i cannot assign a list [1, 2] as key
to a dictionary. Why is that so? Thanks in advanced!

Kind Regards,

Abdur-Rahmaan Janhangeer
about <https://compileralchemy.github.io/> | blog
<https://www.pythonkitchen.com>
github <https://github.com/Abdur-RahmaanJ>
Mauritius

Re: Why no list as dict key?

<jcbhvqFtj5aU1@mid.individual.net>

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: greg.ew...@canterbury.ac.nz (Greg Ewing)
Newsgroups: comp.lang.python
Subject: Re: Why no list as dict key?
Date: Thu, 21 Apr 2022 11:06:31 +1200
Lines: 10
Message-ID: <jcbhvqFtj5aU1@mid.individual.net>
References: <CADrxXXmWEjmQmR0-mP7tugrEJ1YhqBCt_X-57fumqft4=rNPYw@mail.gmail.com>
<mailman.168.1650478937.20749.python-list@python.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: individual.net /00TyyPIZ4zMYJglurndxQ1EHhA6pqmiIxOCwlCK5sMV9Obb8l
Cancel-Lock: sha1:bTuyNbvFlt2un+qZhCTXG8bVE6g=
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:91.0)
Gecko/20100101 Thunderbird/91.3.2
Content-Language: en-US
In-Reply-To: <mailman.168.1650478937.20749.python-list@python.org>
 by: Greg Ewing - Wed, 20 Apr 2022 23:06 UTC

On 21/04/22 6:22 am, Abdur-Rahmaan Janhangeer wrote:
> Using Python3.9, i cannot assign a list [1, 2] as key
> to a dictionary. Why is that so?

If the contents of the list were to change after using it as
a key, its hash value would no longer match its position in
the dict, so subsequent lookups could fail to find it.

--
Greg

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor