-
Notifications
You must be signed in to change notification settings - Fork 258
spec: various minor changes #2013
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
base: main
Are you sure you want to change the base?
Conversation
- Replace an incorrect use of "subtype" with "assignable" - Remove discussion of str/bytes Literal types that seems geared towards Python 2. Instead, say straightforwardly that strings (str objects) and bytes objects are supported. - Rewrite an example that relies on the int/float/complex special case. The example was correct but I think it's confusing to readers if we have examples unnecessarily rely on the special case. Instead, use example types with more straightforward behavior.
docs/spec/literal.rst
Outdated
bools, Enum values and ``None``. So for example, all of | ||
the following would be legal:: | ||
|
||
Literal[26] | ||
Literal[0x1A] # Exactly equivalent to Literal[26] | ||
Literal[-4] | ||
Literal["hello world"] | ||
Literal[u"hello world"] # Exactly equivalent to Literal["hello world"] |
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.
Recommend deleting "Exactly" here. Including it might be confusing. (I'm not sure how equivalency could be inexact. :) )
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.
I did this for consistency with a few lines up, but I'll remove it there too.
docs/spec/literal.rst
Outdated
@@ -98,16 +98,16 @@ expressions, and nothing else. | |||
Legal parameters for ``Literal`` at type check time | |||
""""""""""""""""""""""""""""""""""""""""""""""""""" | |||
|
|||
``Literal`` may be parameterized with literal ints, byte and unicode strings, | |||
``Literal`` may be parameterized with literal ints, strings, `bytes` objects, |
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.
For consistency, maybe use the class names for int
, str
, bytes
, and bool
. With the proposed change, only bytes
uses the actual class name.
Also, I think this requires double backticks.
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.
Done. Also ended up making the enum example more explicit.
Python 2. Instead, say straightforwardly that strings (str objects) and
bytes objects are supported.
The example was correct but I think it's confusing to readers if we have
examples unnecessarily rely on the special case. Instead, use example
types with more straightforward behavior.