This topic created in 4271 days ago, the information mentioned may be changed or developed.
>>> M
[[1, 2, 3], [4, 5, 6], [7, 8, 9]]
>>> [sum(row) for row in M]
[6, 15, 24]
>>> {sum(row) for row in M}
set([24, 6, 15])
9 replies • 2014-09-23 23:35:25 +08:00
 |
|
4
xiandao7997 Sep 22, 2014 1
再搬运下:Like other collections, sets support x in set, len(set), and for x in set. Being an unordered collection, sets do not record element position or order of insertion. Accordingly, sets do not support indexing, slicing, or other sequence-like behavior.
|
 |
|
5
chrishine Sep 22, 2014 1
C++里面的set,map是红黑树(无序的是unordered_set,unordered_map,哈希实现).Java不太清楚,应该也有某个实现是红黑树的吧.
|
 |
|
6
ren2881971 Sep 22, 2014
java里有 HashSet 和 TreeSet 都是无序的 只不过算法不一样。 好像还有一个记不清了。。
|
 |
|
7
stackpop Sep 23, 2014
先理解什么是set, 什么是dict, 为什么有了list还需要set?
|