soy-curd's blog

へぼプログラマーです [https://twitter.com/soycurd1]

2015-01-11から1日間の記事一覧

pythonのreduceについて

pythonで複数の集合を以下のように作成して、 a = set([1,2,3]) b = set([2,3,4]) c = set([3,4,5]) set_list = [a, b, c] これらの和集合を取り出す時、 x = reduce(set.union,set_list) # {1, 2, 3, 4, 5} みたいにreduceにunionを書けることを知った。ど…