-
-
Notifications
You must be signed in to change notification settings - Fork 32k
bpo-41810: Reintroduce types.EllipsisType
, .NoneType
& .NotImplementedType
#22336
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
Merged
Merged
Changes from 8 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
00639fc
Reintroduced `types.EllipsisType`
0a97a88
Replaced `type(...)` and `type(ellipsis)` with `types.EllipsisType`
8aecfd5
Added `EllipsisType` to the documentation
4066b4b
Added Misc/NEWS.d and whatsnew entries
307dcc1
Updated the acknowledgements
9fc1381
Reintroduced `types.NoneType` and `types.NotImplementedType`
2791a23
Replaced `type(NotImplemented)` and `type(None)`
da1ab85
Added `types.NoneType` & `types.NotImplementedType` to whatsnew and t…
f682623
Replaced a duplicate `EllipsisType` with `NotImplementedType`
3701498
Provide motivation for the type reintroduction
33caa6f
Explicitly mention static type checkers
84ebe18
Revert the `type(...)` to `types....` replacements
23ed559
Reworded parts of the `constants` documentation
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -19,14 +19,15 @@ A small number of constants live in the built-in namespace. They are: | |||||||||
|
||||||||||
.. data:: None | ||||||||||
|
||||||||||
The sole value of the type ``NoneType``. ``None`` is frequently used to | ||||||||||
The sole value of the type :data:`types.NoneType`. ``None`` is frequently used to | ||||||||||
represent the absence of a value, as when default arguments are not passed to a | ||||||||||
function. Assignments to ``None`` are illegal and raise a :exc:`SyntaxError`. | ||||||||||
|
||||||||||
|
||||||||||
.. data:: NotImplemented | ||||||||||
|
||||||||||
Special value which should be returned by the binary special methods | ||||||||||
Sole value of the type :data:`types.NotImplementedType` and a | ||||||||||
special value which should be returned by the binary special methods | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See above. Use a parallel construction.
Suggested change
|
||||||||||
(e.g. :meth:`__eq__`, :meth:`__lt__`, :meth:`__add__`, :meth:`__rsub__`, | ||||||||||
etc.) to indicate that the operation is not implemented with respect to | ||||||||||
the other type; may be returned by the in-place binary special methods | ||||||||||
|
@@ -59,7 +60,8 @@ A small number of constants live in the built-in namespace. They are: | |||||||||
.. index:: single: ...; ellipsis literal | ||||||||||
.. data:: Ellipsis | ||||||||||
|
||||||||||
The same as the ellipsis literal "``...``". Special value used mostly in conjunction | ||||||||||
The same as the ellipsis literal "``...``" and sole value of the type | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
:data:`types.EllipsisType`. Special value used mostly in conjunction | ||||||||||
with extended slicing syntax for user-defined container data types. | ||||||||||
|
||||||||||
|
||||||||||
|
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"The sole value of the type NoneType" is most easily read (parsed) as referring to NoneType's usefulness. I expected it to be followed by 'is to ...' and initially read 'is frequently' as a grammatical error. It took awhile to realize that this is a convoluted way to say 'None'. I strongly recommend a rewording.
types.NoneType
is already twice identified as a type, so a third mention is not needed.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on your and Guido's feedback (#22336 (review)) I'm proposing something like this:
Any thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's much better, I think. Although I'd make the last sentence (with the correct markup): "None is the sole instance of the NoneType type."