diff --git a/README.md b/README.md index c374319..018c970 100644 --- a/README.md +++ b/README.md @@ -262,7 +262,7 @@ from types import FunctionType, MethodType, LambdaType, GeneratorType ``` ### Abstract Base Classes -**Each abstract base class specifies a set of virtual subclasses. This classes get recognized by isinstance() and issubclass() as subclasses of the ABC, although they are really not.** +**Each abstract base class specifies a set of virtual subclasses. This classes are then recognized by isinstance() and issubclass() as subclasses of the ABC, although they are really not.** ```python >>> from collections.abc import Sequence, Collection, Iterable @@ -500,7 +500,7 @@ Numbers ### Math ```python -from math import e, pi, inf, nan +from math import e, pi, inf, nan, isinf, isnan from math import cos, acos, sin, asin, tan, atan, degrees, radians from math import log, log10, log2 ``` @@ -1255,7 +1255,7 @@ class MySequence: return reversed(self.a) ``` -### Collections.abc.Sequence +### ABC Sequence * **It's a richer interface than the basic sequence.** * **Extending it generates iter(), contains(), reversed(), index() and count().** * **Unlike `'abc.Iterable'` and `'abc.Collection'`, it is not a duck type. That is why `'issubclass(MySequence, abc.Sequence)'` would return False even if MySequence had all the methods defined.** @@ -1415,7 +1415,7 @@ BaseException +-- NameError # Raised when a variable name is not found. +-- OSError # Failures such as “file not found” or “disk full”. | +-- FileNotFoundError # When a file or directory is requested but doesn't exist. - +-- RuntimeError # Raised by errors that don't fall in other categories. + +-- RuntimeError # Raised by errors that don't fall into other categories. | +-- RecursionError # Raised when the maximum recursion depth is exceeded. +-- StopIteration # Raised by next() when run on an empty iterator. +-- TypeError # Raised when an argument is of wrong type. @@ -1458,8 +1458,8 @@ Exit ```python import sys sys.exit() # Exits with exit code 0 (success). -sys.exit() # Exits with passed exit code. -sys.exit() # Prints the object and exits with 1 (failure). +sys.exit() # Prints object to stderr and exits with 1. +sys.exit() # Exits with the passed exit code. ``` diff --git a/index.html b/index.html index 8b9ed87..b60ed65 100644 --- a/index.html +++ b/index.html @@ -392,7 +392,7 @@ to_exclusive = <range>.stop

Some types do not have built-in names, so they must be imported:

from types import FunctionType, MethodType, LambdaType, GeneratorType
 
-

Abstract Base Classes

Each abstract base class specifies a set of virtual subclasses. This classes get recognized by isinstance() and issubclass() as subclasses of the ABC, although they are really not.

>>> from collections.abc import Sequence, Collection, Iterable
+

Abstract Base Classes

Each abstract base class specifies a set of virtual subclasses. This classes are then recognized by isinstance() and issubclass() as subclasses of the ABC, although they are really not.

>>> from collections.abc import Sequence, Collection, Iterable
 >>> isinstance([1, 2, 3], Iterable)
 True
 
@@ -582,7 +582,7 @@ to_exclusive = <range>.stop <num> = round(<num> [, ±ndigits]) # `round(126, -1) == 130`
-

Math

from math import e, pi, inf, nan
+

Math

from math import e, pi, inf, nan, isinf, isnan
 from math import cos, acos, sin, asin, tan, atan, degrees, radians
 from math import log, log10, log2
 
@@ -1194,7 +1194,7 @@ Hello World!
-

Collections.abc.Sequence

    +

    ABC Sequence

    • It's a richer interface than the basic sequence.
    • Extending it generates iter(), contains(), reversed(), index() and count().
    • Unlike 'abc.Iterable' and 'abc.Collection', it is not a duck type. That is why 'issubclass(MySequence, abc.Sequence)' would return False even if MySequence had all the methods defined.
    • @@ -1329,7 +1329,7 @@ error_msg = traceback.format_exception(exc_type, <name>, <name>.__tr +-- NameError # Raised when a variable name is not found. +-- OSError # Failures such as “file not found” or “disk full”. | +-- FileNotFoundError # When a file or directory is requested but doesn't exist. - +-- RuntimeError # Raised by errors that don't fall in other categories. + +-- RuntimeError # Raised by errors that don't fall into other categories. | +-- RecursionError # Raised when the maximum recursion depth is exceeded. +-- StopIteration # Raised by next() when run on an empty iterator. +-- TypeError # Raised when an argument is of wrong type. @@ -1361,8 +1361,8 @@ error_msg = traceback.format_exception(exc_type, <name>, <name>.__tr

      #Exit

      Exits the interpreter by raising SystemExit exception.

      import sys
       sys.exit()                        # Exits with exit code 0 (success).
      -sys.exit(<int>)                   # Exits with passed exit code.
      -sys.exit(<obj>)                   # Prints the object and exits with 1 (failure).
      +sys.exit(<el>)                    # Prints object to stderr and exits with 1.
      +sys.exit(<int>)                   # Exits with the passed exit code.