parent
cd24cee7b4
commit
3ae7c5bec5
18
pep-0557.rst
18
pep-0557.rst
|
@ -317,13 +317,13 @@ created internally, and are returned by the ``fields()`` module-level
|
|||
method (see below). Users should never instantiate a ``Field``
|
||||
object directly. Its documented attributes are:
|
||||
|
||||
- ``name``: The name of the field.
|
||||
- ``name``: The name of the field.
|
||||
|
||||
- ``type``: The type of the field.
|
||||
- ``type``: The type of the field.
|
||||
|
||||
- ``default``, ``default_factory``, ``init``, ``repr``, ``hash``,
|
||||
``compare``, and ``metadata`` have the identical meaning as they do
|
||||
in the ``field()`` declaration.
|
||||
- ``default``, ``default_factory``, ``init``, ``repr``, ``hash``,
|
||||
``compare``, and ``metadata`` have the identical meaning as they do
|
||||
in the ``field()`` declaration.
|
||||
|
||||
Other attributes may exist, but they are private.
|
||||
|
||||
|
@ -633,11 +633,11 @@ surprising, the initial version of Data Classes will not support
|
|||
automatically setting ``__slots__``. There are a number of
|
||||
workarounds:
|
||||
|
||||
- Manually add ``__slots__`` in the class definition.
|
||||
- Manually add ``__slots__`` in the class definition.
|
||||
|
||||
- Write a function (which could be used as a decorator) that
|
||||
inspects the class using ``fields()`` and creates a new class with
|
||||
``__slots__`` set.
|
||||
- Write a function (which could be used as a decorator) that
|
||||
inspects the class using ``fields()`` and creates a new class with
|
||||
``__slots__`` set.
|
||||
|
||||
For more discussion, see [#]_.
|
||||
|
||||
|
|
Loading…
Reference in New Issue