Skip to content

Commit a336ab4

Browse files
aaronsthynek
andcommitted
docs: fix typos and some grammar (#900)
Co-authored-by: Hynek Schlawack <[email protected]>
1 parent 177a2e6 commit a336ab4

File tree

8 files changed

+13
-13
lines changed

8 files changed

+13
-13
lines changed

docs/examples.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ Keyword-only attributes allow subclasses to add attributes without default value
166166
...
167167
TypeError: B() missing 1 required keyword-only argument: 'b'
168168

169-
If you don't set ``kw_only=True``, then there's is no valid attribute ordering and you'll get an error:
169+
If you don't set ``kw_only=True``, then there is no valid attribute ordering, and you'll get an error:
170170

171171
.. doctest::
172172

docs/hashing.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Because according to the definition_ from the official Python docs, the returned
4747

4848
The easiest way to reset ``__hash__`` on a class is adding ``__hash__ = object.__hash__`` in the class body.
4949

50-
#. If two object are not equal, their hash **should** be different.
50+
#. If two objects are not equal, their hash **should** be different.
5151

5252
While this isn't a requirement from a standpoint of correctness, sets and dicts become less effective if there are a lot of identical hashes.
5353
The worst case is when all objects have the same hash which turns a set into a list.
@@ -80,7 +80,7 @@ If such objects are to be stored in hash-based collections, it can be useful to
8080
To enable caching of hash codes, pass ``cache_hash=True`` to ``@attrs``.
8181
This may only be done if ``attrs`` is already generating a hash function for the object.
8282

83-
.. [#fn1] The hash is computed by hashing a tuple that consists of an unique id for the class plus all attribute values.
83+
.. [#fn1] The hash is computed by hashing a tuple that consists of a unique id for the class plus all attribute values.
8484
8585
.. _definition: https://docs.python.org/3/glossary.html#term-hashable
8686
.. _`Python Hashes and Equality`: https://hynek.me/articles/hashes-and-equality/

docs/init.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ Derived Attributes
448448

449449
One of the most common ``attrs`` questions on *Stack Overflow* is how to have attributes that depend on other attributes.
450450
For example if you have an API token and want to instantiate a web client that uses it for authentication.
451-
Based on the previous sections, there's two approaches.
451+
Based on the previous sections, there are two approaches.
452452

453453
The simpler one is using ``__attrs_post_init__``::
454454

docs/names.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ In the wake of all of that, `glyph <https://twitter.com/glyph>`_ and `Hynek <htt
4343
At this point the plan was not to make ``attrs`` what it is now -- a flexible class building kit.
4444
All we wanted was an ergonomic little library to succinctly define classes with attributes.
4545

46-
Under the impression of of the unwieldy ``characteristic`` name, we went to the other side and decided to make the package name part of the API, and keep the API functions very short.
46+
Under the impression of the unwieldy ``characteristic`` name, we went to the other side and decided to make the package name part of the API, and keep the API functions very short.
4747
This led to the infamous `attr.s` and `attr.ib` which some found confusing and pronounced it as "attr dot s" or used a singular ``@s`` as the decorator.
4848
But it was really just a way to say ``attrs`` and ``attrib``\ [#attr]_.
4949

@@ -72,7 +72,7 @@ A big change happened in May 2017 when Hynek sat down with `Guido van Rossum <ht
7272
Type annotations for class attributes have `just landed <https://www.python.org/dev/peps/pep-0526/>`_ in Python 3.6 and Guido felt like it would be a good mechanic to introduce something similar to ``attrs`` to the Python standard library.
7373
The result, of course, was `PEP 557 <https://www.python.org/dev/peps/pep-0557/>`_\ [#stdlib]_ which eventually became the `dataclasses` module in Python 3.7.
7474

75-
``attrs`` at this point was lucky to have several people on board who were also very excited about type annotations and helped implementing it; including a `Mypy plugin <https://medium.com/@Pilot-EPD-Blog/mypy-and-attrs-e1b0225e9ac6>`_.
75+
``attrs`` at this point was lucky to have several people on board who were also very excited about type annotations and helped implement it; including a `Mypy plugin <https://medium.com/@Pilot-EPD-Blog/mypy-and-attrs-e1b0225e9ac6>`_.
7676
And so it happened that ``attrs`` `shipped <https://www.attrs.org/en/17.3.0.post2/changelog.html>`_ the new method of defining classes more than half a year before Python 3.7 -- and thus `dataclasses` -- were released.
7777

7878
-----
@@ -90,7 +90,7 @@ We're determined to serve both.
9090
^^^^^^^^^^^^^
9191

9292
Over its existence, ``attrs`` never stood still.
93-
But since we also greatly care about backward compatibility and not breaking our users's code, many features and niceties have to be manually activated.
93+
But since we also greatly care about backward compatibility and not breaking our users' code, many features and niceties have to be manually activated.
9494

9595
That is not only annoying, it also leads to the problem that many of ``attrs``'s users don't even know what it can do for them.
9696
We've spent years alone explaining that defining attributes using type annotations is in no way unique to `dataclasses`.

docs/overview.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ What ``attrs`` Is Not
4949

5050
All ``attrs`` does is:
5151

52-
1. take your declaration,
52+
1. Take your declaration,
5353
2. write :term:`dunder methods` based on that information,
5454
3. and attach them to your class.
5555

docs/python-2.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Feasibility in this case means:
1212
1. Possibility to run the tests on our development computers,
1313
2. and **free** CI options.
1414

15-
This can mean that we will have to run our tests on PyPy, whose maintainters have unequivocally declared that they do not intend to stop the development and maintenance of their Python 2-compatible line at all.
15+
This can mean that we will have to run our tests on PyPy, whose maintainers have unequivocally declared that they do not intend to stop the development and maintenance of their Python 2-compatible line at all.
1616
And this can mean that at some point, a sponsor will have to step up and pay for bespoke CI setups.
1717

1818
**However**: there is no promise of new features coming to ``attrs`` running under Python 2.

docs/types.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ You can choose freely between the approaches, but please remember that if you ch
2222

2323
----
2424

25-
Even when going all-in an type annotations, you will need `attr.field` for some advanced features though.
25+
Even when going all-in on type annotations, you will need `attr.field` for some advanced features though.
2626

2727
One of those features are the decorator-based features like defaults.
2828
It's important to remember that ``attrs`` doesn't do any magic behind your back.
@@ -42,7 +42,7 @@ If you need to resolve these to real types, you can call `attrs.resolve_types` w
4242

4343
In practice though, types show their biggest usefulness in combination with tools like mypy_, pytype_, or pyright_ that have dedicated support for ``attrs`` classes.
4444

45-
The addition of static types is certainly one of the most exciting features in the Python ecosystem and helps you writing *correct* and *verified self-documenting* code.
45+
The addition of static types is certainly one of the most exciting features in the Python ecosystem and helps you write *correct* and *verified self-documenting* code.
4646

4747
If you don't know where to start, Carl Meyer gave a great talk on `Type-checked Python in the Real World <https://www.youtube.com/watch?v=pMgmKJyWKn8>`_ at PyCon US 2018 that will help you to get started in no time.
4848

docs/why.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Basically what ``attrs`` was in 2015.
3939
…pydantic?
4040
----------
4141

42-
*pydantic* is first an foremost a *data validation library*.
42+
*pydantic* is first and foremost a *data validation library*.
4343
As such, it is a capable complement to class building libraries like ``attrs`` (or Data Classes!) for parsing and validating untrusted data.
4444

4545
However, as convenient as it might be, using it for your business or data layer `is problematic in several ways <https://threeofwands.com/why-i-use-attrs-instead-of-pydantic/>`_:
@@ -89,7 +89,7 @@ Other often surprising behaviors include:
8989
- Iterability also implies that it's easy to accidentally unpack a ``namedtuple`` which leads to hard-to-find bugs. [#iter]_
9090
- ``namedtuple``\ s have their methods *on your instances* whether you like it or not. [#pollution]_
9191
- ``namedtuple``\ s are *always* immutable.
92-
Not only does that mean that you can't decide for yourself whether your instances should be immutable or not, it also means that if you want to influence your class' initialization (validation? default values?), you have to implement :meth:`__new__() <object.__new__>` which is a particularly hacky and error-prone requirement for a very common problem. [#immutable]_
92+
Not only does that mean that you can't decide for yourself whether your instances should be immutable or not, it also means that if you want to influence your class' initialization (validation? default values?), you have to implement :meth:`__new__() <object.__new__>` which is a particularly hacky and error-prone requirement for a very common problem. [#immutable]_
9393
- To attach methods to a ``namedtuple`` you have to subclass it.
9494
And if you follow the standard library documentation's recommendation of::
9595

0 commit comments

Comments
 (0)