python基本数据类型之set

 

 

 


 set:  集合

  基本操作:

    • 循环
    • 长度

    

  1 #!/usr/bin/env python
  2 # -*- coding: utf-8 -*-
  3 
  4 """ 基本数据类型之set """
  5 
  6 
  7 class set(object):
  8     """
  9     set() -> new empty set object
 10     set(iterable) -> new set object
 11 
 12     Build an unordered collection of unique elements.
 13     """
 14 
 15     def add(self, *args, **kwargs):  # real signature unknown
 16         """ 向集合中添加元素,如果该元素已存在则不添加 """
 17         """
 18         Add an element to a set.
 19 
 20         This has no effect if the element is already present.
 21         """
 22         pass
 23 
 24     def clear(self, *args, **kwargs):  # real signature unknown
 25         """ 清空集合 """
 26         """ Remove all elements from this set. """
 27         pass
 28 
 29     def copy(self, *args, **kwargs):  # real signature unknown
 30         """ 浅拷贝 """
 31         """ Return a shallow copy of a set. """
 32         pass
 33 
 34     def difference(self, *args, **kwargs):  # real signature unknown
 35         """ 返回A中存在B中不存在的元素 """
 36         """
 37         Return the difference of two or more sets as a new set.
 38 
 39         (i.e. all elements that are in this set but not the others.)
 40         """
 41         pass
 42 
 43     def difference_update(self, *args, **kwargs):  # real signature unknown
 44         """ 返回A中存在B中不存在的元素并将其更新给A """
 45         """ Remove all elements of another set from this set. """
 46         pass
 47 
 48     def discard(self, *args, **kwargs):  # real signature unknown
 49         """ 移除指定元素,不存在不报错 """
 50         """
 51         Remove an element from a set if it is a member.
 52 
 53         If the element is not a member, do nothing.
 54         """
 55         pass
 56 
 57     def intersection(self, *args, **kwargs):  # real signature unknown
 58         """ 交集 """
 59         """
 60         Return the intersection of two sets as a new set.
 61 
 62         (i.e. all elements that are in both sets.)
 63         """
 64         pass
 65 
 66     def intersection_update(self, *args, **kwargs):  # real signature unknown
 67         """ 取交集并更新到A """
 68         """ Update a set with the intersection of itself and another. """
 69         pass
 70 
 71     def isdisjoint(self, *args, **kwargs):  # real signature unknown
 72         """ 如果没有交集返回True,否则返回False """
 73         """ Return True if two sets have a null intersection. """
 74         pass
 75 
 76     def issubset(self, *args, **kwargs):  # real signature unknown
 77         """ 如果A是B的子集,返回True,否则返回False """
 78         """ Report whether another set contains this set. """
 79         pass
 80 
 81     def issuperset(self, *args, **kwargs):  # real signature unknown
 82         """ 如果A是B的父集,返回True,否则返回False """
 83         """ Report whether this set contains another set. """
 84         pass
 85 
 86     def pop(self, *args, **kwargs):  # real signature unknown
 87         """ 随机删除集合中的元素 """
 88         """
 89         Remove and return an arbitrary set element.
 90         Raises KeyError if the set is empty.
 91         """
 92         pass
 93 
 94     def remove(self, *args, **kwargs):  # real signature unknown
 95         """ 移除集合中的指定元素 """
 96         """
 97         Remove an element from a set; it must be a member.
 98 
 99         If the element is not a member, raise a KeyError.
100         """
101         pass
102 
103     def symmetric_difference(self, *args, **kwargs):  # real signature unknown
104         """ 对称差集 """
105         """
106         Return the symmetric difference of two sets as a new set.
107 
108         (i.e. all elements that are in exactly one of the sets.)
109         """
110         pass
111 
112     def symmetric_difference_update(self, *args, **kwargs):  # real signature unknown
113         """ 取对称差集并更新到A """
114         """ Update a set with the symmetric difference of itself and another. """
115         pass
116 
117     def union(self, *args, **kwargs):  # real signature unknown
118         """ 并集 """
119         """
120         Return the union of sets as a new set.
121 
122         (i.e. all elements that are in either set.)
123         """
124         pass
125 
126     def update(self, *args, **kwargs):  # real signature unknown
127         """ 更新 """
128         """ Update a set with the union of itself and others. """
129         pass
130 
131     def __and__(self, *args, **kwargs):  # real signature unknown
132         """ Return self&value. """
133         pass
134 
135     def __contains__(self, y):  # real signature unknown; restored from __doc__
136         """ x.__contains__(y) <==> y in x. """
137         pass
138 
139     def __eq__(self, *args, **kwargs):  # real signature unknown
140         """ Return self==value. """
141         pass
142 
143     def __getattribute__(self, *args, **kwargs):  # real signature unknown
144         """ Return getattr(self, name). """
145         pass
146 
147     def __ge__(self, *args, **kwargs):  # real signature unknown
148         """ Return self>=value. """
149         pass
150 
151     def __gt__(self, *args, **kwargs):  # real signature unknown
152         """ Return self>value. """
153         pass
154 
155     def __iand__(self, *args, **kwargs):  # real signature unknown
156         """ Return self&=value. """
157         pass
158 
159     def __init__(self, seq=()):  # known special case of set.__init__
160         """
161         set() -> new empty set object
162         set(iterable) -> new set object
163 
164         Build an unordered collection of unique elements.
165         # (copied from class doc)
166         """
167         pass
168 
169     def __ior__(self, *args, **kwargs):  # real signature unknown
170         """ Return self|=value. """
171         pass
172 
173     def __isub__(self, *args, **kwargs):  # real signature unknown
174         """ Return self-=value. """
175         pass
176 
177     def __iter__(self, *args, **kwargs):  # real signature unknown
178         """ Implement iter(self). """
179         pass
180 
181     def __ixor__(self, *args, **kwargs):  # real signature unknown
182         """ Return self^=value. """
183         pass
184 
185     def __len__(self, *args, **kwargs):  # real signature unknown
186         """ Return len(self). """
187         pass
188 
189     def __le__(self, *args, **kwargs):  # real signature unknown
190         """ Return self<=value. """
191         pass
192 
193     def __lt__(self, *args, **kwargs):  # real signature unknown
194         """ Return self<value. """
195         pass
196 
197     @staticmethod  # known case of __new__
198     def __new__(*args, **kwargs):  # real signature unknown
199         """ Create and return a new object.  See help(type) for accurate signature. """
200         pass
201 
202     def __ne__(self, *args, **kwargs):  # real signature unknown
203         """ Return self!=value. """
204         pass
205 
206     def __or__(self, *args, **kwargs):  # real signature unknown
207         """ Return self|value. """
208         pass
209 
210     def __rand__(self, *args, **kwargs):  # real signature unknown
211         """ Return value&self. """
212         pass
213 
214     def __reduce__(self, *args, **kwargs):  # real signature unknown
215         """ Return state information for pickling. """
216         pass
217 
218     def __repr__(self, *args, **kwargs):  # real signature unknown
219         """ Return repr(self). """
220         pass
221 
222     def __ror__(self, *args, **kwargs):  # real signature unknown
223         """ Return value|self. """
224         pass
225 
226     def __rsub__(self, *args, **kwargs):  # real signature unknown
227         """ Return value-self. """
228         pass
229 
230     def __rxor__(self, *args, **kwargs):  # real signature unknown
231         """ Return value^self. """
232         pass
233 
234     def __sizeof__(self):  # real signature unknown; restored from __doc__
235         """ S.__sizeof__() -> size of S in memory, in bytes """
236         pass
237 
238     def __sub__(self, *args, **kwargs):  # real signature unknown
239         """ Return self-value. """
240         pass
241 
242     def __xor__(self, *args, **kwargs):  # real signature unknown
243         """ Return self^value. """
244         pass
245 
246     __hash__ = None

 

 

 

  

posted @ 2018-07-30 22:33  Sorcerer  阅读(113)  评论(0)    收藏  举报