]> granicus.if.org Git - python/commitdiff
Update code examples using collections.abc classes.
authorGeorg Brandl <georg@python.org>
Sun, 14 Apr 2013 08:50:05 +0000 (10:50 +0200)
committerGeorg Brandl <georg@python.org>
Sun, 14 Apr 2013 08:50:05 +0000 (10:50 +0200)
Doc/library/collections.abc.rst

index 115ce101b0c1c167c396f97833c990462afb4c61..06dfe806ea484553a24be54c8a7c3eae6810275a 100644 (file)
@@ -128,7 +128,7 @@ These ABCs allow us to ask classes or instances if they provide
 particular functionality, for example::
 
     size = None
-    if isinstance(myvar, collections.Sized):
+    if isinstance(myvar, collections.abc.Sized):
         size = len(myvar)
 
 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__`.
 The ABC supplies the remaining methods such as :meth:`__and__` and
 :meth:`isdisjoint`::
 
-    class ListBasedSet(collections.Set):
+    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):