Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #71973
| Newsgroups | comp.lang.python |
|---|---|
| Date | 2014-05-24 15:05 -0700 |
| Message-ID | <38836877-cd87-44ce-b9df-1eda702e7164@googlegroups.com> (permalink) |
| Subject | Numpy Array of Sets |
| From | Luis José Novoa <luisjosenovoa@gmail.com> |
Hi All, Hope you're doing great. One quick question. I am defining an array of sets using numpy as: a=array([set([])]*3) Now, if I want to add an element to the set in, lets say, a[0], and I use the .add(4) operation, which results in: array([set([4]), set([4]), set([4])], dtype=object) which I do not want. If I use the union operator a[0] = a[0] | set([4]) then I obtain what I want: array([set([4]), set([]), set([])], dtype=object) Can anyone explain whay this happens? Thank you very much.
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Numpy Array of Sets Luis José Novoa <luisjosenovoa@gmail.com> - 2014-05-24 15:05 -0700
Re: Numpy Array of Sets Robert Kern <robert.kern@gmail.com> - 2014-05-24 23:14 +0100
Re: Numpy Array of Sets Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de> - 2014-05-25 00:25 +0200
Re: Numpy Array of Sets LJ <luisjosenovoa@gmail.com> - 2014-05-25 05:29 -0700
Re: Numpy Array of Sets Peter Otten <__peter__@web.de> - 2014-05-25 15:26 +0200
Re: Numpy Array of Sets LJ <luisjosenovoa@gmail.com> - 2014-05-25 07:14 -0700
Re: Numpy Array of Sets Peter Otten <__peter__@web.de> - 2014-05-25 17:12 +0200
Re: Numpy Array of Sets LJ <luisjosenovoa@gmail.com> - 2014-05-25 08:17 -0700
csiph-web