diff --git a/README.md b/README.md index da01ea7..eebf882 100644 --- a/README.md +++ b/README.md @@ -257,7 +257,7 @@ Type #### Some types do not have built-in names, so they must be imported: ```python -from types import FunctionType, MethodType, LambdaType, GeneratorType +from types import FunctionType, MethodType, LambdaType, GeneratorType, ModuleType ``` ### Abstract Base Classes @@ -1813,7 +1813,7 @@ import csv * **`'skipinitialspace'` - Whether whitespace after delimiter gets stripped.** * **`'lineterminator'` - Specifies how writer terminates rows.** * **`'quoting'` - Controls the amount of quoting: 0 - as necessary, 1 - all.** -* **`'escapechar'` - Character for escaping 'quotechar' if 'doublequote' is False.** +* **`'escapechar'` - Character for escaping quotechars if doublequote is False.** ### Dialects ```text @@ -2165,8 +2165,8 @@ Introspection = vars() # Dict of writable attributes. Also .__dict__. = hasattr(, '') # Checks if getattr() raises an AttributeError. value = getattr(, '') # Raises AttributeError if attribute is missing. -setattr(, '', value) # Only works on objects with __dict__ attribute. -delattr(, '') # Equivalent to `del .`. +setattr(, '', value) # Only works on objects with '__dict__' attribute. +delattr(, '') # Same. Also `del .`. ``` ### Parameters @@ -2187,7 +2187,7 @@ Metaprogramming **Type is the root class. If only passed an object it returns its type (class). Otherwise it creates a new class.** ```python - = type('', , ) + = type('', , ) ``` ```python diff --git a/index.html b/index.html index 2e416ed..6af908e 100644 --- a/index.html +++ b/index.html @@ -226,7 +226,7 @@ pre.prettyprint {
- +
@@ -412,7 +412,7 @@ to_exclusive = <range>.stop
>>> type('a'), 'a'.__class__, str
 (<class 'str'>, <class 'str'>, <class 'str'>)
 
-

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

from types import FunctionType, MethodType, LambdaType, GeneratorType
+

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

from types import FunctionType, MethodType, LambdaType, GeneratorType, ModuleType
 

Abstract Base Classes

Each abstract base class specifies a set of virtual subclasses. These classes are then recognized by isinstance() and issubclass() as subclasses of the ABC, although they are really not. ABC can also manually decide whether or not a specific class is its virtual subclass, usually based on which methods the class has implemented. For instance, Iterable ABC looks for method iter() while Collection ABC looks for methods iter(), contains() and len().

>>> from collections.abc import Sequence, Collection, Iterable
@@ -1661,7 +1661,7 @@ CompletedProcess(args=['bc', 'skipinitialspace' - Whether whitespace after delimiter gets stripped.
 
  • 'lineterminator' - Specifies how writer terminates rows.
  • 'quoting' - Controls the amount of quoting: 0 - as necessary, 1 - all.
  • -
  • 'escapechar' - Character for escaping 'quotechar' if 'doublequote' is False.
  • +
  • 'escapechar' - Character for escaping quotechars if doublequote is False.
  • Dialects

    ┏━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━┓
     ┃                  │     excel    │   excel-tab  │     unix     ┃
     ┠──────────────────┼──────────────┼──────────────┼──────────────┨
    @@ -1927,8 +1927,8 @@ last_el          = op.methodcaller('pop')(<l
     <dict> = vars(<object>)                    # Dict of writable attributes. Also <obj>.__dict__.
     <bool> = hasattr(<object>, '<attr_name>')  # Checks if getattr() raises an AttributeError.
     value  = getattr(<object>, '<attr_name>')  # Raises AttributeError if attribute is missing.
    -setattr(<object>, '<attr_name>', value)    # Only works on objects with __dict__ attribute.
    -delattr(<object>, '<attr_name>')           # Equivalent to `del <object>.<attr_name>`.
    +setattr(<object>, '<attr_name>', value)    # Only works on objects with '__dict__' attribute.
    +delattr(<object>, '<attr_name>')           # Same. Also `del <object>.<attr_name>`.
     

    Parameters

    from inspect import signature
    @@ -1938,7 +1938,7 @@ delattr(<object>, '<attr_name>')
     <memb> = <Param>.kind                      # Member of ParameterKind enum.
     
    -

    #Metaprogramming

    Code that generates code.

    Type

    Type is the root class. If only passed an object it returns its type (class). Otherwise it creates a new class.

    <class> = type('<class_name>', <parents_tuple>, <attributes_dict>)
    +

    #Metaprogramming

    Code that generates code.

    Type

    Type is the root class. If only passed an object it returns its type (class). Otherwise it creates a new class.

    <class> = type('<class_name>', <tuple_of_parents>, <dict_of_class_attributes>)
    @@ -3017,7 +3017,7 @@ $ pyinstaller script.py --add-data '<path>:.'
    - +
    diff --git a/parse.js b/parse.js index ab5bdbe..b3bba3b 100755 --- a/parse.js +++ b/parse.js @@ -71,7 +71,7 @@ const OS_RENAME = 'os.replace(from, to) # Same, but overwrites \'to\' if it exists.\n'; const TYPE = - '<class> = type(\'<class_name>\', <parents_tuple>, <attributes_dict>)'; + '<class> = type(\'<class_name>\', <tuple_of_parents>, <dict_of_class_attributes>)'; const EVAL = '>>> from ast import literal_eval\n' + @@ -526,7 +526,7 @@ function fixHighlights() { $(`code:contains(make_dataclass(\'\')`).html(DATACLASS); $(`code:contains(shutil.copy)`).html(SHUTIL_COPY); $(`code:contains(os.rename)`).html(OS_RENAME); - $(`code:contains(\'\', , )`).html(TYPE); + $(`code:contains(\'\', , )`).html(TYPE); $(`code:contains(ValueError: malformed node)`).html(EVAL); $(`code:contains(pip3 install tqdm)`).html(PROGRESS_BAR); $(`code:contains(pip3 install pyinstaller)`).html(PYINSTALLER);