Skip to content

incorrect description that dose not conform to the actual behavior #73162

Description

@wooyoo
mannequin
BPO 28976
Nosy @bitdancer, @brendan-donegan, @brendan-donegan

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:

assignee = None
closed_at = <Date 2016-12-15.15:53:05.344>
created_at = <Date 2016-12-15.03:24:55.391>
labels = ['invalid', 'docs']
title = 'incorrect description that dose not conform to the actual behavior'
updated_at = <Date 2016-12-15.15:53:05.343>
user = 'https://bugs.python.org/wooyoo'

bugs.python.org fields:

activity = <Date 2016-12-15.15:53:05.343>
actor = 'woo yoo'
assignee = 'docs@python'
closed = True
closed_date = <Date 2016-12-15.15:53:05.344>
closer = 'woo yoo'
components = ['Documentation']
creation = <Date 2016-12-15.03:24:55.391>
creator = 'woo yoo'
dependencies = []
files = []
hgrepos = []
issue_num = 28976
keywords = []
message_count = 17.0
messages = ['283232', '283233', '283269', '283273', '283274', '283276', '283282', '283284', '283308', '283315', '283320', '283321', '283322', '283324', '283328', '283329', '283331']
nosy_count = 5.0
nosy_names = ['r.david.murray', 'docs@python', 'woo yoo', 'brendan-donegan', 'brendand']
pr_nums = []
priority = 'normal'
resolution = 'not a bug'
stage = 'resolved'
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue28976'
versions = ['Python 3.5']

Activity

  1. wooyoo commented on Dec 15, 2016

    wooyoomannequin
    MannequinAuthor

    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.

  2. wooyoo commented on Dec 15, 2016

    wooyoomannequin
    MannequinAuthor
  3. brendan-donegan commented on Dec 15, 2016

    brendan-doneganmannequin
    Mannequin

    Can you provide a code snippet that demonstrates the actual problem? As far as I can see this code behaves as documented

  4. wooyoo commented on Dec 15, 2016

    wooyoomannequin
    MannequinAuthor
    code :
    >>> if 1<2<3:print(123);print(op);
    
    Output:
    123
    Traceback (most recent call last):
    .... 
    NameError:...
  5. brendan-donegan commented on Dec 15, 2016

    brendan-doneganmannequin
    Mannequin

    How does that contradict the documentation? Both print statements were executed - the second one raised an exception because of 'op' not being defined.

  6. wooyoo commented on Dec 15, 2016

    wooyoomannequin
    MannequinAuthor
    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.

  7. brendan-donegan commented on Dec 15, 2016

    brendan-doneganmannequin
    Mannequin

    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

  8. wooyoo commented on Dec 15, 2016

    wooyoomannequin
    MannequinAuthor

    Thanks for your attention.

  9. wooyoo commented on Dec 15, 2016

    wooyoomannequin
    MannequinAuthor

    Why the issue was closed?

  10. reopened this on Dec 15, 2016
  11. bitdancer commented on Dec 15, 2016

    @bitdancer
    Member

    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.

  12. wooyoo commented on Dec 15, 2016

    wooyoomannequin
    MannequinAuthor

    According to the original description, "either all or none...",what does 'none' represent?

  13. brendan-donegan commented on Dec 15, 2016

    brendan-doneganmannequin
    Mannequin

    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\>


  14. wooyoo commented on Dec 15, 2016

    wooyoomannequin
    MannequinAuthor

    "either all or none of the print() calls are executed",I think the 'none' describes the number of the calls to be executed.

  15. brendan-donegan commented on Dec 15, 2016

    brendan-doneganmannequin
    Mannequin

    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\>


  16. wooyoo commented on Dec 15, 2016

    wooyoomannequin
    MannequinAuthor

    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)

  17. bitdancer commented on Dec 15, 2016

    @bitdancer
    Member

    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.

  18. wooyoo commented on Dec 15, 2016

    wooyoomannequin
    MannequinAuthor

    I think i understand you now.My english needs to improve.Thanks for your patience.

  19. transferred this issue fromon Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions