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


Groups > comp.lang.python > #102652

Set Operations on Dicts

From Marco Kaulea <marco.kaulea@gmail.com>
Newsgroups comp.lang.python
Subject Set Operations on Dicts
Date 2016-02-08 10:56 +0100
Message-ID <mailman.86.1454925476.2317.python-list@python.org> (permalink)

Show all headers | View raw


Hi,

In one talk (I think it was [1]) it was described that sets are basically
dicts without the values.
Therefor it should be easy to apply set operations on dicts, for example:
{'a': 123, 'b': 456} & {'a'} => {'a': 123}
{'a': 123, 'b': 456} - {'a'} => {'b': 456}

This if currently not implemented. Is there a technical reason that this is
difficult or are
there a lot of corner cases that make it not worth the trouble?

I have not spend a lot of time on this, I just needed a feature like that
and was surprised that
it did not exists.

- Marco

[1] https://www.youtube.com/watch?v=C4Kc8xzcA68

Back to comp.lang.python | Previous | NextNext 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