Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #101319
| From | Grobu <snailcoder@retrosite.invalid> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: How to union nested Sets / A single set from nested sets? |
| Date | 2016-01-07 05:59 +0100 |
| Organization | A noiseless patient Spider |
| Message-ID | <n6kr5v$amj$1@dont-email.me> (permalink) |
| References | <mailman.19.1452086285.2305.python-list@python.org> |
On 04/01/16 03:40, mviljamaa wrote: > I'm forming sets by set.adding to sets and this leads to sets such as: > > Set([ImmutableSet(['a', ImmutableSet(['a'])]), ImmutableSet(['b', 'c'])]) > > Is there way union these to a single set, i.e. get > > Set(['a', 'b', 'c']) > > ? There's a built-in "union" method for sets : >>> a = set( ['a', 'b'] ) >>> b = set( ['c', 'd'] ) >>> a.union(b) set(['a', 'c', 'b', 'd']) HTH
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How to union nested Sets / A single set from nested sets? mviljamaa <mviljamaa@kapsi.fi> - 2016-01-04 04:40 +0200
Re: How to union nested Sets / A single set from nested sets? Rustom Mody <rustompmody@gmail.com> - 2016-01-06 08:19 -0800
Re: How to union nested Sets / A single set from nested sets? Grobu <snailcoder@retrosite.invalid> - 2016-01-07 05:59 +0100
Re: How to union nested Sets / A single set from nested sets? Joel Goldstick <joel.goldstick@gmail.com> - 2016-01-07 00:33 -0500
csiph-web