Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document that Either should not be used in new code #1699

Merged
merged 4 commits into from
Aug 10, 2022

Conversation

mdickinson
Copy link
Member

This PR adds notes to the user manual and API documentation to discourage users from using Either in new code. (Union should be preferred.)

Closes #1610

@mdickinson mdickinson added component: documentation Issues related to the Sphinx documentation porting: needs backport to 6.4 This PR needs to be backported to the maint/6.4 branch labels Aug 10, 2022
@@ -238,10 +238,11 @@ Traits
.. autoclass:: ToolbarButton
:show-inheritance:

.. autoclass:: Either
.. autoclass:: Union
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deliberately swapping the order so that Union appears before Either in the docs.

There's also a drive-by fix here: :show-inheritance: was missing for Union, for no reason that I can discern.

@@ -269,7 +269,7 @@ the table.
.. index:: PythonValue(), Range(), ReadOnly(), Regex()
.. index:: Set() String(), This, Time()
.. index:: ToolbarButton(), true, Tuple(), Type()
.. index:: undefined, UUID(), ValidatedTuple(), WeakRef()
.. index:: undefined, Union(), UUID(), ValidatedTuple(), WeakRef()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another drive-by fix: Union was missing from this list of index entries.

@@ -408,7 +408,7 @@ the table.
| Union | Union( *val1*\ [, *val2*, ..., *valN*, |
| | \*\*\ *metadata*] ) |
+------------------+----------------------------------------------------------+
| UUID [4]_ | UUID( [\*\*\ *metadata*] ) |
| UUID | UUID( [\*\*\ *metadata*] ) |
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dropped the [4] footnote, which talked about Python 2.5; I've re-used it for Either.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: footnote 4 comes before footnote 3 (attached to Function and Method) in the text.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks; fixed. At the same time, I fixed that the current footnotes start from the third natural number, rather than the second as is more conventional.

Copy link
Contributor

@corranwebster corranwebster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of nit-picky sorts of comments.

@@ -408,7 +408,7 @@ the table.
| Union | Union( *val1*\ [, *val2*, ..., *valN*, |
| | \*\*\ *metadata*] ) |
+------------------+----------------------------------------------------------+
| UUID [4]_ | UUID( [\*\*\ *metadata*] ) |
| UUID | UUID( [\*\*\ *metadata*] ) |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: footnote 4 comes before footnote 3 (attached to Function and Method) in the text.

docs/source/traits_user_manual/defining.rst Show resolved Hide resolved
@mdickinson mdickinson merged commit c5cfdde into main Aug 10, 2022
@mdickinson mdickinson deleted the docs/either-should-not-be-used-in-new-code branch August 10, 2022 13:52
mdickinson added a commit that referenced this pull request Aug 10, 2022
This PR adds notes to the user manual and API documentation to discourage users from using Either in new code. (Union should be preferred.)

(cherry picked from commit c5cfdde)
@mdickinson mdickinson removed the porting: needs backport to 6.4 This PR needs to be backported to the maint/6.4 branch label Aug 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: documentation Issues related to the Sphinx documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update "Either" documentation to indicate that "Union" is preferred.
2 participants