集合(Set)を扱うPythonのモジュールを調べたり試したり.
- setモジュール/ set module
- len(s): 集合sの要素数を返す
- x in s: xがsのメンバーに含まれていればTrueを返す
- x not in s: xがsのメンバーに含まれていればTrueを返す
- s.isdisjoint(t): sとtが共通の要素を持たない時,すなわち互いに素(disjoint)な時にTrueを返す
- s.issubset(t): sがtの部分集合ならTrueを返す
- set <= other: setの全ての要素がotherに含まれればTrueを返す
- set < other: setがotherの真部分集合であればTrueを返す
- set >= other: otherの全ての要素がsetに含まれればTrueを返す
- set > other: setがotherの真上位集合であればTrueを返す
- set.union(other): setとotherの和集合を返す
- set.intersection(other): setとotherの積集合を返す
- set.difference(other): 差集合(setに含まれている要素のうち,otherに含まれていない要素を持つ集合)を返す
- set.add(elem): elemをsetの要素に追加
- set.remove(elem): setの要素elemを削除.elemがsetに含まれていなければKeyErrorを返す
- set.discard(elem): elemがsetの要素であれば削除
- set.pop(): setから任意に要素を選び削除.setがからであればKeyErrorを返す
- set.clear(): setの全要素を削除
- sympy.sets.sets.FiniteSet