Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kLYX2-0000lW-9h for psycopg@arkaria.postgresql.org; Thu, 24 Sep 2020 21:12:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kLYWz-0001PW-NU for psycopg@arkaria.postgresql.org; Thu, 24 Sep 2020 21:11:57 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kLYWz-0001PP-GY for psycopg@lists.postgresql.org; Thu, 24 Sep 2020 21:11:57 +0000 Received: from mout.gmx.net ([212.227.15.15]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kLYWu-00081s-I4 for psycopg@lists.postgresql.org; Thu, 24 Sep 2020 21:11:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1600981910; bh=gtoGCIpZSXTxtZiiHecHEkYOJbDU/eo4qdo1ADxslWQ=; h=X-UI-Sender-Class:Date:From:To:Subject:References:In-Reply-To; b=AIf6lrfpwkCcZdREtmXANad4DUZpKmDYJk9Z46b91cl/nPbnI93PGM0ET8rycngCU q0DJ+4U7awxwHe3ngutvZXwyf3xiI94j72AgUdSTCgIaSfPU0UPUVlpw6G7/r+4Cwk F5uOXEp98GjubAIpTIrVQ1ZuNNs2Hk0pfq2iewGU= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from hermes ([78.54.73.84]) by mail.gmx.com (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MC34h-1k9D8S2l25-00CRzP for ; Thu, 24 Sep 2020 23:11:50 +0200 Received: from ncq by hermes with local (Exim 4.94) (envelope-from ) id 1kLYWp-0005fr-4u for psycopg@lists.postgresql.org; Thu, 24 Sep 2020 23:11:47 +0200 Date: Thu, 24 Sep 2020 23:11:47 +0200 From: Karsten Hilbert To: psycopg@lists.postgresql.org Subject: Re: iterating over DictRow Message-ID: <20200924211147.GA2089@hermes.hilbert.loc> References: <20200923215444.GA25406@hermes.hilbert.loc> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Ma_X_il-Followup-to: d Re_X_turn-receipt-to: Karsten.Hilbert@gmx.net Di_X_sposition-Notification-To: Karsten.Hilbert@gmx.net X-Confi_X_rm-Reading-To: Karsten.Hilbert@gmx.net X-Pri_X_ority: 2 (High) Sender: X-Provags-ID: V03:K1:evTvh6bJSmUlIIhejwViqY9pYTJQ7AqpWvRizpMjhoRYiox7W3o pU2jl0DwD5iPY+1cOG+fGNU72I9+FNqJeLl6u/wPrLfJdVhVM0/z9ZgmgdQFa8xI/b2ivwq iP0Iniv0/ZV3wP3jb9B1cNn3PG/+AimcxO20CtPqh5i2ax3AZcFWYAabZjjMaOrfucWCSad G3dmcW92dOy1abxWD0LUQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:F5F5KEiH40o=:/1CRo+um4RIJ6BOuq8gFZx Ju5Lv1zExokj6+uSQH0ThLt4Fv4cJTUr3xwRA8x/kOTkb6KPl+TuYYA2GLit+yFP5O3QuRyrE 1vjyr0Z4/cbfco8KnSiPoNs7nzMHwo8sMEnPjIAlU5PePsXhcGbKh+Jm+uNQAGezRdQeJr/Yj lfLBAZc5BsjsTf7wKvI1W4Nsj0e4Fgftz81PJGzpFD6rhtDcnkV9qZWOIw7RR3G0F0rG+8bIw MBZyQjFz60t8M4B6thIvnJp++cYtoYt2Va+5xGDRfNHuyrkl5tgNbxiaDA8o28SRLumjIzWj3 ZKFEjM8O7NnwQW2g7+KdYLQgB/rbCvCrfG7N6guQfnHt5o+/fxHbNGVtDNK28Xf/Mx8A5HWK4 9MVw1yEPlhtOhoA3aO12FHvMPJYGSyghpzOvJduCX+mhtQovAjxAUB1/dnjXbZgPr7oOngpJx pdLi4qNDDqIntEfc1FKt1WPW9XLM3JXgcLcjwrHKPKtjuagwmnVie55AKb1pdxG74V/57Wrai I6+7h2S6O0zeFPNuJP7IU6uGg8FGgJpmI/KUhGxnlxm8DTz+XjNM+dh6fmu4OHDEpmqAyhhWc 30t4IHP/k93iDii6o5kNCq1GiW/UWuXlq/A7nmc1kC0YGRblsLG8+6HM9XCzUnGjKrYBomfF2 Cj3dlYVWLIi6geNmDHlHDpEAvvnPYadcVejScDYiYw7MKDtByWGeDGARlgDD3q0hOjdqESWQZ Kusg03FEPfbUG4aFMd3q6i4QRWV6kM2sG6OMc9m4zH3W7R/yD2DPmVHs8jJpXe7mnx4G11lGn MfA+hqUSsNS5r1ChUGbs7Ucav3aKF47SQDuA0w5w06xfZv1fQLVtsnEB4TBFW3cHAFKHb34AD iMfTd+u0Ne7rcoGQ9B6b5FzjUfRAISFu/nndzJ1NvCudBzwmnnc8gUEs/rLvrEqZPdcTaGU1r +W2T63K3X9nUtTttFkeKS2TqKqbzq2/60fyM9UFj+U0WzIFnqAoq6I3sAl9qwHm74ipeD/slu tsfOvS248TtrNJu6YDeRURrixzxXwoyWVqwoNbX3ebzU58gKKOmmtOWflG4jzWfX1jrXY2D2O zoQzO8UqczPyP5MZ4IABrMYM7mrpWV9Yu1z9qb7nb/m4r7OKEcflqXbcof8PUHFFI6q4NFKi6 C/9hq3jhv7Ry81fRmm9dwKZdjrRpnK0KF2I/zBEXMpOxeu42b5Ctn7K8Qb8G0Pz+caWFcekye lgemRNpMFYTX6lDeUNk8Gg8K4kJARDHPTOA2ZIA== Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Thu, Sep 24, 2020 at 02:53:40PM +0000, David Raymond wrote: > Since DictRow's can be indexed by either the field name or > the field index (either record["ID"] or record[0]) then I > think what it "should" be is a little ambiguous. I eventually thought so. I was, however, wondering whether I should have _expected_ iteration over a DictRow to be a list iteration. Either of those > for field in dict(the_dict): > for field in the_dict.keys(): work, however (or RealDictCursor, for that matter). Thanks all, Karsten =2D- GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B