-
-
Notifications
You must be signed in to change notification settings - Fork 359
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Split cmp into eq and order Fixes #170 * Fix tests on old pypy3 versions Old as in: currently on AP. * Fix issue number and clarify newsfragment * Clarify behavior and interaction between cmp/eq/order * This sounds better * Address Julian's review comments * Missed a cmp * Test the behavior of Attribute.cmp * Make test more idiomatic * Explain assumptions * Clarify comment * Grammar * One more cmp!
- Loading branch information
Showing
17 changed files
with
478 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
The ``cmp`` argument to ``attr.s()`` and ``attr.ib()`` is now deprecated. | ||
|
||
Please use ``eq`` to add equality methods (``__eq__`` and ``__ne__``) and ``order`` to add ordering methods (``__lt__``, ``__le__``, ``__gt__``, and ``__ge__``) instead – just like with `dataclasses <https://docs.python.org/3/library/dataclasses.html>`_. | ||
|
||
Both are effectively ``True`` by default but it's enough to set ``eq=False`` to disable both at once. | ||
Passing ``eq=False, order=True`` explicitly will raise a ``ValueError`` though. | ||
|
||
Since this is arguably a deeper backward-compatibility break, it will have an extended deprecation period until 2021-06-01. | ||
After that day, the ``cmp`` argument will be removed. | ||
|
||
``attr.Attribute`` also isn't orderable anymore. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.