Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5f4b4ac

Browse files
committed
Update code examples using collections.abc classes.
1 parent 7b8c132 commit 5f4b4ac

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Doc/library/collections.abc.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ These ABCs allow us to ask classes or instances if they provide
128128
particular functionality, for example::
129129

130130
size = None
131-
if isinstance(myvar, collections.Sized):
131+
if isinstance(myvar, collections.abc.Sized):
132132
size = len(myvar)
133133

134134
Several of the ABCs are also useful as mixins that make it easier to develop
@@ -138,7 +138,7 @@ abstract methods: :meth:`__contains__`, :meth:`__iter__`, and :meth:`__len__`.
138138
The ABC supplies the remaining methods such as :meth:`__and__` and
139139
:meth:`isdisjoint`::
140140

141-
class ListBasedSet(collections.Set):
141+
class ListBasedSet(collections.abc.Set):
142142
''' Alternate set implementation favoring space over speed
143143
and not requiring the set elements to be hashable. '''
144144
def __init__(self, iterable):

0 commit comments

Comments
 (0)