-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
incorrect description that dose not conform to the actual behavior #73162
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
Comments
The paragraph that describes the precedence of semicolon encounters a minor error, which said : |
Forget to attach the link https://docs.python.org/3/reference/compound_stmts.html#compound-statements |
Can you provide a code snippet that demonstrates the actual problem? As far as I can see this code behaves as documented |
code :
>>> if 1<2<3:print(123);print(op);
Output:
123
Traceback (most recent call last):
....
NameError:... |
How does that contradict the documentation? Both print statements were executed - the second one raised an exception because of 'op' not being defined. |
code :
>>> if 1<2<3:print(123);print(op);print(opi);
Output:
123
Traceback (most recent call last):
....
NameError:name 'op' is not defined The third 'print' call hasn't been executed. |
Indeed, but that's merely because an exception has been raised. The example given doesn't include any statements that would raise an exception. I'm not sure it's necessary to re-iterate well known Python behaviour in this section. Anyway, that's my 2c |
Thanks for your attention. |
Why the issue was closed? |
Because the documentation is correct. There is no bug here. As Brendan said, there is no need to repeat a fundamental (that statements can raise exceptions) in this context. The point of the passage is that if x: a; b; c; is equivalent to if x:
a
b
c not if x: a
b
c And that is what it clearly says, in my opinion. The language reference is a specification and not a tutorial, so more words here would not be a good idea. |
According to the original description, "either all or none...",what does 'none' represent? |
None represents the case where the if statement is false On Thu, 15 Dec 2016 at 20:40 woo yoo <report@bugs.python.org> wrote:
|
"either all or none of the print() calls are executed",I think the 'none' describes the number of the calls to be executed. |
I think the consensus is that the wording is correct. If you can come up On Thu, 15 Dec 2016 at 20:50 woo yoo <report@bugs.python.org> wrote:
|
In fact, I'm a newcomer to Python. When i have experimented with those description interactively using Python interpreter, i got confused. I don't know how to submit a patch.If the description were changed by me,it would be:
|
As I said, the language reference is a specification, not a tutorual. The text as written is clear technical English. You are correct that 'none' refers to the number of statements executed, but 'none' are executed when the statement is false, and 'all' are executed when the statement is true. The fact that execution of a suite may be interrupted by an exception is covered elsewhere in the language reference and it would not enhance the documentation to repeat it here. If other core developers think putting in the example is appropriate I'm not going to object, but I don't think they will. |
I think i understand you now.My english needs to improve.Thanks for your patience. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: