관리-도구
편집 파일: set.cpython-36.opt-1.pyc
3 �b�W# � @ s d Z G dd� de�ZdS )zA simple Set class.c @ s e Zd ZdZdgZdDdd�Zdd� Zdd � Zd d� Zdd � Z dd� Z dd� Zdd� Zdd� Z dd� Zdd� Zdd� Zdd� Zdd� Zd d!� Zd"d#� Zd$d%� Zd&d'� Zd(d)� Zd*d+� Zd,d-� Zd.d/� Zd0d1� Zd2d3� Zd4d5� Zd6d7� Zd8d9� Zd:d;� Z d<d=� Z!d>d?� Z"d@dA� Z#dBdC� Z$dS )E�Seta' A simple set class. Sets are not in Python until 2.3, and rdata are not immutable so we cannot use sets.Set anyway. This class implements subset of the 2.3 Set interface using a list as the container. @ivar items: A list of the items which are in the set @type items: list�itemsNc C s* g | _ |dk r&x|D ]}| j|� qW dS )zvInitialize the set. @param items: the initial set of items @type items: any iterable or None N)r �add)�selfr �item� r �/usr/lib/python3.6/set.py�__init__ s zSet.__init__c C s dt | j� S )Nzdns.simpleset.Set(%s))�reprr )r r r r �__repr__, s zSet.__repr__c C s || j kr| j j|� dS )zAdd an item to the set.N)r �append)r r r r r r / s zSet.addc C s | j j|� dS )zRemove an item from the set.N)r �remove)r r r r r r 4 s z Set.removec C s* y| j j|� W n tk r$ Y nX dS )z'Remove an item from the set if present.N)r r � ValueError)r r r r r �discard8 s zSet.discardc C s | j }|j|�}t| j�|_|S )a� Make a (shallow) copy of the set. There is a 'clone protocol' that subclasses of this class should use. To make a copy, first call your super's _clone() method, and use the object returned as the new instance. Then make shallow copies of the attributes defined in the subclass. This protocol allows us to write the set algorithms that return new instances (e.g. union) once, and keep using them in subclasses. )� __class__�__new__�listr )r �cls�objr r r �_clone? s z Set._clonec C s | j � S )z!Make a (shallow) copy of the set.)r )r r r r �__copy__Q s zSet.__copy__c C s | j � S )z!Make a (shallow) copy of the set.)r )r r r r �copyU s zSet.copyc C s<