Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

The first version always gets thrown away.


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

SubjectAuthor
o Re: Why no list as dict key?Lars Liedtke

1
Re: Why no list as dict key?

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

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: lal...@solute.de (Lars Liedtke)
Newsgroups: comp.lang.python
Subject: Re: Why no list as dict key?
Date: Mon, 25 Apr 2022 15:13:19 +0200
Lines: 65
Message-ID: <mailman.249.1650892977.20749.python-list@python.org>
References: <CADrxXXmWEjmQmR0-mP7tugrEJ1YhqBCt_X-57fumqft4=rNPYw@mail.gmail.com>
<CAPTjJmovXqzOemVUCSoLQS--7egCj9ZQFA9DOQ9U=mgcFvUnZg@mail.gmail.com>
<CADrxXX=z_rtsBs29SDzPJTqgcHcUaKFcNUu4AXcCdoi0X+2-fA@mail.gmail.com>
<YmDGBT1SDbiUc8a4@scrozzle>
<CADrxXXkQekikNbeBxWpM=yLc6Vk2C5JSFo1AN2Db0fX7uSPNFQ@mail.gmail.com>
<CAPTjJmph9HRduN2Ms74t13ORB+zEYXmfCZLVMz=MStpnYsABxg@mail.gmail.com>
<be8b7956-d34c-3d78-ec2b-d74f293625ef@solute.de>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"; format=flowed
Content-Transfer-Encoding: quoted-printable
X-Trace: news.uni-berlin.de 8nYCN9GW21JGio0SpIuBtAmBRb3Vs3mx9i0/rIaU9vbA==
Return-Path: <lal@solute.de>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=none reason="no signature";
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.032
X-Spam-Evidence: '*H*': 0.94; '*S*': 0.00; '2022': 0.05; 'assumes':
0.07; 'matching': 0.07; 'string': 0.07; 'subject:Why': 0.07;
'meant': 0.09; 'schrieb': 0.09; 'url:de': 0.09; 'subject:list':
0.11; '(even': 0.16; '721': 0.16; 'brands': 0.16; 'chrisa': 0.16;
'dict': 0.16; 'equal.': 0.16; 'gmbh': 0.16; 'hash': 0.16;
'ignorance': 0.16; 'iterable': 0.16; 'janhangeer': 0.16; 'key,':
0.16; 'sitz': 0.16; 'wrote:': 0.16; 'instead': 0.17; 'thu,': 0.19;
'to:addr:python-list': 0.20; 'received:de': 0.23; 'register':
0.25; 'object': 0.26; 'chris': 0.28; 'header:User-Agent:1': 0.30;
'same,': 0.32; 'but': 0.32; 'same': 0.34; 'header:In-Reply-To:1':
0.34; 'using': 0.37; "it's": 0.37; 'could': 0.38; 'use': 0.39;
'still': 0.40; 'data.': 0.40; 'received:213': 0.40; 'something':
0.40; 'want': 0.40; 'policy': 0.62; 'germany': 0.62; 'skip:z 10':
0.62; 'come': 0.62; 'simply': 0.63; 'your': 0.64; 'privacy': 0.64;
'look': 0.65; 'that,': 0.67; 'phone:': 0.68; 'amtsgericht': 0.69;
'der': 0.69; 'too.': 0.70; 'easy': 0.74; 'fax:': 0.75; 'url:php':
0.75; 'cheers': 0.76; 'yes': 0.76; 'dr.': 0.77; 'up,': 0.84;
'ask,': 0.84; 'court:': 0.84; 'identity,': 0.84; 'url-ip:62/8':
0.84; 'e-mail:': 0.88
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.7.0
Content-Language: en-US
In-Reply-To: <CAPTjJmph9HRduN2Ms74t13ORB+zEYXmfCZLVMz=MStpnYsABxg@mail.gmail.com>
X-ClientProxiedBy: solute-exc2019.solute.ka (10.11.5.25) To
solute-exc2019.solute.ka (10.11.5.25)
X-EsetResult: clean, is OK
X-EsetId: 37303A291E3FD152677266
X-C2ProcessedOrg: 6b8a70a0-c2cb-4e72-a27d-0fc2d5a54e94
X-CrossPremisesHeadersFilteredBySendConnector: solute-exc2019.solute.ka
X-OrganizationHeadersPreserved: solute-exc2019.solute.ka
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: <be8b7956-d34c-3d78-ec2b-d74f293625ef@solute.de>
X-Mailman-Original-References: <CADrxXXmWEjmQmR0-mP7tugrEJ1YhqBCt_X-57fumqft4=rNPYw@mail.gmail.com>
<CAPTjJmovXqzOemVUCSoLQS--7egCj9ZQFA9DOQ9U=mgcFvUnZg@mail.gmail.com>
<CADrxXX=z_rtsBs29SDzPJTqgcHcUaKFcNUu4AXcCdoi0X+2-fA@mail.gmail.com>
<YmDGBT1SDbiUc8a4@scrozzle>
<CADrxXXkQekikNbeBxWpM=yLc6Vk2C5JSFo1AN2Db0fX7uSPNFQ@mail.gmail.com>
<CAPTjJmph9HRduN2Ms74t13ORB+zEYXmfCZLVMz=MStpnYsABxg@mail.gmail.com>
 by: Lars Liedtke - Mon, 25 Apr 2022 13:13 UTC

May I stupidly ask, why one would want to use an iterable (even
immutable) as dict key?

I thought keys were meant to be something "singular". And yes you could
also combine a string to be a key, and if you combine a string it would
be somehow the same as a tuple. But anyways I still fail to see the
application for that, which is most propably to ignorance rather than
criticism.

Cheers

Lars

--
Lars Liedtke
Software Entwickler


Phone:
Fax: +49 721 98993-
E-mail: lal@solute.de

solute GmbH
Zeppelinstraße 15
76185 Karlsruhe
Germany

Marken der solute GmbH | brands of solute GmbH
billiger.de | Shopping.de

Geschäftsführer | Managing Director: Dr. Thilo Gans, Bernd Vermaaten
Webseite | www.solute.de
Sitz | Registered Office: Karlsruhe
Registergericht | Register Court: Amtsgericht Mannheim
Registernummer | Register No.: HRB 110579
USt-ID | VAT ID: DE234663798

Informationen zum Datenschutz | Information about privacy policy
http://solute.de/ger/datenschutz/grundsaetze-der-datenverarbeitung.php

Am 21.04.22 um 07:00 schrieb Chris Angelico:
> On Thu, 21 Apr 2022 at 13:23, Abdur-Rahmaan Janhangeer
> <arj.python@gmail.com> wrote:
>> Assumes checking for object equality before inserting.
>> If they are they same, do we need different hashes?
>>
> The point of the hash is to find things that are equal. That's why
> 1234, 1234.0, and 0j+1234.0 all have the same hash.
>
> If equality changes, the hash does too. It's certainly possible to
> have the hash come from object identity, but then so must equality. If
> you want that, it's easy to do - just create your own object for the
> state, rather than using a list. But then you have to use the original
> object to look things up, instead of matching by the data.
>
> Hashes are simply a short-hand for equality. That's all.
>
> ChrisA

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor