Fix some minor typos.

This commit is contained in:
Barry Warsaw 2017-09-11 11:10:36 -07:00
parent 4c8bf1956e
commit 6d4f10e59d
1 changed files with 15 additions and 15 deletions

View File

@ -143,12 +143,12 @@ The ``dataclass`` decorator examines the class to find ``field``'s. A
type annotation. With a single exception described below, none of the
Data Class machinery examines the type specified in the annotation.
Note that ``__annotations__`` is guaranateed to be an ordered mapping,
Note that ``__annotations__`` is guaranteed to be an ordered mapping,
in class declaration order. The order of the fields in all of the
generated methods is the order in which they appear in the class.
The ``dataclass`` decorator is typically used with no parameters and
no parenthesis. However, it also supports the following logical
no parentheses. However, it also supports the following logical
signature::
def dataclass(*, init=True, repr=True, hash=None, cmp=True, frozen=False)
@ -197,14 +197,14 @@ The parameters to ``dataclass`` are:
superclass is object, this means it will fall back to id-based
hashing).
Although not recommended, you force Data Classes to create a
``__hash__`` method ``hash=True``. This might be the case if your
class is logically immutable but can none the less be mutated. This
Although not recommended, you can force Data Classes to create a
``__hash__`` method with ``hash=True``. This might be the case if your
class is logically immutable but can nonetheless be mutated. This
is a specialized use case and should be considered carefully.
See the Python documentation [#]_ for more information.
- ``frozen``: If true, assigning to fields will generate an exception.
- ``frozen``: If True, assigning to fields will generate an exception.
This emulates read-only frozen instances. See the discussion below.
``field``'s may optionally specify a default value, using normal
@ -235,22 +235,22 @@ The parameters to ``field()`` are:
field. This is needed because the ``field`` call itself replaces
the normal position of the default value.
- ``default_factory``: If provided, a zero-argument callable that will
be called when a default value is needed for this field. Among
other purposes, this can be used to specify fields with mutable
default values, discussed below. It is an error to specify both
``default`` and ``default_factory``.
- ``default_factory``: If provided, it must be a zero-argument
callable that will be called when a default value is needed for this
field. Among other purposes, this can be used to specify fields
with mutable default values, as discussed below. It is an error to
specify both ``default`` and ``default_factory``.
- ``init``: If true, this field is included as a parameter to the
- ``init``: If True, this field is included as a parameter to the
generated ``__init__`` function.
- ``repr``: If true, this field is included in the string returned by
- ``repr``: If True, this field is included in the string returned by
the generated ``__repr__`` function.
- ``cmp``: If true, this field is included in the generated comparison
- ``cmp``: If True, this field is included in the generated comparison
methods (``__eq__`` et al).
- ``hash``: This can be a bool or ``None``. If true, this field is
- ``hash``: This can be a bool or ``None``. If True, this field is
included in the generated ``__hash__`` method. If ``None`` (the
default), use the value of ``cmp``: this would normally be the
expected behavior. A field needs to be considered in the hash if