Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #102728

Re: Set Operations on Dicts

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Ian Kelly <ian.g.kelly@gmail.com>
Newsgroups comp.lang.python
Subject Re: Set Operations on Dicts
Date Tue, 9 Feb 2016 08:14:15 -0700
Lines 11
Message-ID <mailman.10.1455030904.29838.python-list@python.org> (permalink)
References <mailman.86.1454925476.2317.python-list@python.org> <n9a2jk$9s$1@dont-email.me> <mailman.106.1454948013.2317.python-list@python.org> <n9c3rd$1vt$1@dont-email.me>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace news.uni-berlin.de 6IhaU1QJD1gAD6NKZFHRUAsqcjYs5PMitvRW1Wqg1h6w==
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.032
X-Spam-Evidence '*H*': 0.94; '*S*': 0.00; 'dict': 0.09; 'python': 0.10; 'applies': 0.15; '2016': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'set-like': 0.16; 'substitute': 0.16; 'wrote:': 0.16; 'am,': 0.23; 'feb': 0.23; 'header:In-Reply-To:1': 0.24; 'message-id:@mail.gmail.com': 0.27; 'expose': 0.29; 'received:209.85.213.174': 0.29; 'seemingly': 0.29; 'tue,': 0.34; 'received:google.com': 0.35; 'but': 0.36; 'received:209.85': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:209.85.213': 0.37; 'received:209': 0.38; 'does': 0.39; 'to:addr:python.org': 0.40; '2.7.': 0.84; 'to:name:python': 0.84; 'subject:Set': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=MFY2aZSF9jqcziv8US7w00/YLYZ112kK5UPAWimqvgo=; b=YgzhGH8txTJCtbRNZjaZGQysGph2zMtTKVXr64xdYb0GXwSJr+TAoTkPihUypKAwlX S8Of/ej3M6oO0nVVvazKA/75WfYHRywEn4mIXT66/MdLaEaD+irCEb423FVdugiuf4WQ jEfdAouYv00/rCNotcOVqF3m3dJflBHo36RUxosFaLLu6zcta8JB8x67mpz6sWE3lN+4 sXqHPHCqH7XTfpTo/qxcZqC/PL8ZoIHjUTKz5M+2GxB4yS7zxJ815OK4CI48iDMjjVQp vGsKyJwi31/DN+YyQp8h0q3f/YVH9ZSqt8Y3k7fnjAYoo+lMxxIuluTU5f3Et/SIdzq1 MH3w==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-type; bh=MFY2aZSF9jqcziv8US7w00/YLYZ112kK5UPAWimqvgo=; b=Sro9dB320HtKeQen9EkTi/Hb51PEUZj2E1RWrRcm0c6rGegaO5yKX97gE8SuhA/F2K XtnzAs6qIVL8jsKx+2md3ss5/Pd6ia7UdIh+7z3wzrdy+g7G07de9MwXFoxIbZaxTjnH zqe1j6mDmP4/rsODS+HiZrGawsX0nNQvvmHGU/r6cjkR9bAxTVy4riXIk8Rm6XB+kgdN xwPLA5F4livQhP9wK6h7jWubOyvZMueQgMOXpTSXbv1egOJN/WcJ/NvbkrMYo13L900H pNkqZAnX5KQSeiE32BAXqPUxUmgDPaXkctdnPj1ek72zhXaiIafgZlsoxDnHWIwRrKEb xhfA==
X-Gm-Message-State AG10YOSwPdJwJUsTdLONzVIjopFTmr1xz/KNp5ciceFs173MaFtyH0PCXS7X9YgJ4HbL7Ixky5imM+X5JQQt0Q==
X-Received by 10.50.61.177 with SMTP id q17mr4822666igr.68.1455030895122; Tue, 09 Feb 2016 07:14:55 -0800 (PST)
In-Reply-To <n9c3rd$1vt$1@dont-email.me>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.21rc2
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 <http://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>
Xref csiph.com comp.lang.python:102728

Show key headers only | View raw


On Tue, Feb 9, 2016 at 12:21 AM, Grobu <snailcoder@retrosite.invalid> wrote:
> On 08/02/16 17:12, Ian Kelly wrote:
>
>> dict does already expose set-like views. How about:
>>
>> {k: d[k] for k in d.keys() & s}  # d & s
>> {k: d[k] for k in d.keys() - s}  # d - s
>>
> Interesting. But seemingly only applies to Python 3.

Substitute d.viewkeys() for d.keys() in Python 2.7.

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Set Operations on Dicts Marco Kaulea <marco.kaulea@gmail.com> - 2016-02-08 10:56 +0100
  Re: Set Operations on Dicts Jussi Piitulainen <jussi.piitulainen@helsinki.fi> - 2016-02-08 14:17 +0200
    Re: Set Operations on Dicts Marco Kaulea <marco.kaulea@gmail.com> - 2016-02-08 13:33 +0100
    Re: Set Operations on Dicts Matt Wheeler <m@funkyhat.org> - 2016-02-08 13:32 +0000
      Re: Set Operations on Dicts Jussi Piitulainen <jussi.piitulainen@helsinki.fi> - 2016-02-08 16:02 +0200
    Re: Set Operations on Dicts Random832 <random832@fastmail.com> - 2016-02-08 09:52 -0500
      Re: Set Operations on Dicts Jussi Piitulainen <jussi.piitulainen@helsinki.fi> - 2016-02-08 17:05 +0200
  Re: Set Operations on Dicts Grobu <snailcoder@retrosite.invalid> - 2016-02-08 13:47 +0100
    Re: Set Operations on Dicts Ian Kelly <ian.g.kelly@gmail.com> - 2016-02-08 09:12 -0700
      Re: Set Operations on Dicts Grobu <snailcoder@retrosite.invalid> - 2016-02-09 08:21 +0100
        Re: Set Operations on Dicts Ian Kelly <ian.g.kelly@gmail.com> - 2016-02-09 08:14 -0700

csiph-web