msg283232 - (view) |
Author: woo yoo (woo yoo) |
Date: 2016-12-15 03:24 |
The paragraph that describes the precedence of semicolon encounters a minor error, which said :
"Also note that the semicolon binds tighter than the colon in this context, so that in the following example, either all or none of the print() calls are executed:
if x < y < z: print(x); print(y); print(z)"
However,the series of print function calls could execute partly if the previous ones are legal.
|
msg283233 - (view) |
Author: woo yoo (woo yoo) |
Date: 2016-12-15 03:26 |
Forget to attach the link https://docs.python.org/3/reference/compound_stmts.html#compound-statements
|
msg283269 - (view) |
Author: Brendan Donegan (brendan-donegan) * |
Date: 2016-12-15 09:41 |
Can you provide a code snippet that demonstrates the actual problem? As far as I can see this code behaves as documented
|
msg283273 - (view) |
Author: woo yoo (woo yoo) |
Date: 2016-12-15 10:03 |
code :
>>> if 1<2<3:print(123);print(op);
Output:
123
Traceback (most recent call last):
....
NameError:...
|
msg283274 - (view) |
Author: Brendan Donegan (brendan-donegan) * |
Date: 2016-12-15 10:08 |
How does that contradict the documentation? Both print statements were executed - the second one raised an exception because of 'op' not being defined.
|
msg283276 - (view) |
Author: woo yoo (woo yoo) |
Date: 2016-12-15 10:21 |
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.
|
msg283282 - (view) |
Author: Brendan Donegan (brendan-donegan) * |
Date: 2016-12-15 11:07 |
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
|
msg283284 - (view) |
Author: woo yoo (woo yoo) |
Date: 2016-12-15 11:17 |
Thanks for your attention.
|
msg283308 - (view) |
Author: woo yoo (woo yoo) |
Date: 2016-12-15 14:26 |
Why the issue was closed?
|
msg283315 - (view) |
Author: R. David Murray (r.david.murray) * |
Date: 2016-12-15 14:57 |
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.
|
msg283320 - (view) |
Author: woo yoo (woo yoo) |
Date: 2016-12-15 15:10 |
According to the original description, "either all or none...",what does 'none' represent?
|
msg283321 - (view) |
Author: Brendan Donegan (brendand) |
Date: 2016-12-15 15:13 |
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:
>
> woo yoo added the comment:
>
> According to the original description, "either all or none...",what does
> 'none' represent?
>
> ----------
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue28976>
> _______________________________________
>
|
msg283322 - (view) |
Author: woo yoo (woo yoo) |
Date: 2016-12-15 15:20 |
"either all or none of the print() calls are executed",I think the 'none' describes the number of the calls to be executed.
|
msg283324 - (view) |
Author: Brendan Donegan (brendand) |
Date: 2016-12-15 15:23 |
I think the consensus is that the wording is correct. If you can come up
with text that is clearer, and still correct, please do submit a patch.
On Thu, 15 Dec 2016 at 20:50 woo yoo <report@bugs.python.org> wrote:
>
> woo yoo added the comment:
>
> "either all or none of the print() calls are executed",I think the 'none'
> describes the number of the calls to be executed.
>
> ----------
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue28976>
> _______________________________________
>
|
msg283328 - (view) |
Author: woo yoo (woo yoo) |
Date: 2016-12-15 15:35 |
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:
>if x<y<z:print(x);print(y);print(z)
>is equivalent to
>if x<y<z:
> print(x)
> print(y)
> print(z)
|
msg283329 - (view) |
Author: R. David Murray (r.david.murray) * |
Date: 2016-12-15 15:42 |
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.
|
msg283331 - (view) |
Author: woo yoo (woo yoo) |
Date: 2016-12-15 15:52 |
I think i understand you now.My english needs to improve.Thanks for your patience.
|
|
Date |
User |
Action |
Args |
2022-04-11 14:58:40 | admin | set | github: 73162 |
2016-12-15 15:53:05 | woo yoo | set | status: open -> closed resolution: not a bug |
2016-12-15 15:52:18 | woo yoo | set | messages:
+ msg283331 |
2016-12-15 15:42:11 | r.david.murray | set | messages:
+ msg283329 |
2016-12-15 15:35:54 | woo yoo | set | messages:
+ msg283328 |
2016-12-15 15:23:17 | brendand | set | messages:
+ msg283324 |
2016-12-15 15:20:46 | woo yoo | set | messages:
+ msg283322 |
2016-12-15 15:13:27 | brendand | set | nosy:
+ brendand messages:
+ msg283321
|
2016-12-15 15:10:28 | woo yoo | set | messages:
+ msg283320 |
2016-12-15 14:57:05 | r.david.murray | set | nosy:
+ r.david.murray messages:
+ msg283315
|
2016-12-15 14:46:26 | woo yoo | set | status: closed -> open resolution: not a bug -> (no value) |
2016-12-15 14:26:21 | woo yoo | set | messages:
+ msg283308 |
2016-12-15 14:14:04 | r.david.murray | set | status: open -> closed resolution: not a bug stage: resolved |
2016-12-15 11:17:59 | woo yoo | set | messages:
+ msg283284 |
2016-12-15 11:07:28 | brendan-donegan | set | messages:
+ msg283282 |
2016-12-15 10:21:20 | woo yoo | set | messages:
+ msg283276 |
2016-12-15 10:08:03 | brendan-donegan | set | messages:
+ msg283274 |
2016-12-15 10:03:08 | woo yoo | set | messages:
+ msg283273 |
2016-12-15 09:41:29 | brendan-donegan | set | nosy:
+ brendan-donegan messages:
+ msg283269
|
2016-12-15 03:26:17 | woo yoo | set | messages:
+ msg283233 |
2016-12-15 03:24:55 | woo yoo | create | |