diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-05-10 09:01:56 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-05-10 09:01:56 (GMT) |
commit | c499f30286976410be13c8476408531bb21631ce (patch) | |
tree | 86b8972b6663726a50d716bb13773171f1ca425a /Doc/library/collections.abc.rst | |
parent | a4dfbe608fb52191b435c5545e8a343586887135 (diff) | |
parent | dba903993a8d3e13d2cf83d6a8912e908025b17b (diff) | |
download | cpython-c499f30286976410be13c8476408531bb21631ce.zip cpython-c499f30286976410be13c8476408531bb21631ce.tar.gz cpython-c499f30286976410be13c8476408531bb21631ce.tar.bz2 |
Issue #23921: Standardized documentation whitespace formatting.
Original patch by James Edwards.
Diffstat (limited to 'Doc/library/collections.abc.rst')
-rw-r--r-- | Doc/library/collections.abc.rst | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/Doc/library/collections.abc.rst b/Doc/library/collections.abc.rst index 2385587..ec10a1e 100644 --- a/Doc/library/collections.abc.rst +++ b/Doc/library/collections.abc.rst @@ -225,19 +225,22 @@ The ABC supplies the remaining methods such as :meth:`__and__` and :meth:`isdisjoint`:: class ListBasedSet(collections.abc.Set): - ''' Alternate set implementation favoring space over speed - and not requiring the set elements to be hashable. ''' - def __init__(self, iterable): - self.elements = lst = [] - for value in iterable: - if value not in lst: - lst.append(value) - def __iter__(self): - return iter(self.elements) - def __contains__(self, value): - return value in self.elements - def __len__(self): - return len(self.elements) + ''' Alternate set implementation favoring space over speed + and not requiring the set elements to be hashable. ''' + def __init__(self, iterable): + self.elements = lst = [] + for value in iterable: + if value not in lst: + lst.append(value) + + def __iter__(self): + return iter(self.elements) + + def __contains__(self, value): + return value in self.elements + + def __len__(self): + return len(self.elements) s1 = ListBasedSet('abcdef') s2 = ListBasedSet('defghi') |