Skip to content
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

Left to right #34910

Closed
tim-one opened this issue Aug 7, 2001 · 6 comments
Closed

Left to right #34910

tim-one opened this issue Aug 7, 2001 · 6 comments
Labels
docs Documentation in the Doc dir

Comments

@tim-one
Copy link
Member

tim-one commented Aug 7, 2001

BPO 448679
Nosy @tim-one, @loewis
Files
  • ref5.diff
  • evalorder.patch
  • 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 2002-12-16.14:05:20.000>
    created_at = <Date 2001-08-07.06:55:27.000>
    labels = ['docs']
    title = 'Left to right'
    updated_at = <Date 2002-12-16.14:05:20.000>
    user = 'https://github.com/tim-one'

    bugs.python.org fields:

    activity = <Date 2002-12-16.14:05:20.000>
    actor = 'niemeyer'
    assignee = 'niemeyer'
    closed = True
    closed_date = None
    closer = None
    components = ['Documentation']
    creation = <Date 2001-08-07.06:55:27.000>
    creator = 'tim.peters'
    dependencies = []
    files = ['108', '109']
    hgrepos = []
    issue_num = 448679
    keywords = []
    message_count = 6.0
    messages = ['5810', '5811', '5812', '5813', '5814', '5815']
    nosy_count = 3.0
    nosy_names = ['tim.peters', 'loewis', 'niemeyer']
    pr_nums = []
    priority = 'normal'
    resolution = 'accepted'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue448679'
    versions = ['Python 2.3']

    @tim-one
    Copy link
    Member Author

    tim-one commented Aug 7, 2001

    The Ref Man doesn't explicitly say anything about
    Python's left-to-right evaluation order. Strict left-
    to-right was Guido's intent, though, and it comes up a
    few times per year on c.l.py (indeed, I was just
    replying to a msg asking about it).

    The docs should get fleshed out.

    There's also a bug:

    >>> counter = 0
    >>> def i():
    ...     global counter
    ...     counter += 1
    ...     return counter
    ...
    >>> {i(): i()}
    {2: 1}
    >>> {i(): i(), i(): i()}
    {4: 3, 6: 5}
    >>>

    That is, key:value *pairs* are evaluated left to
    right, but within a single key:value pair, the value
    gets evaluated first. When I asked Guido about that
    some years ago, he agreed it was a bug.

    @tim-one tim-one closed this as completed Aug 7, 2001
    @tim-one tim-one added the docs Documentation in the Doc dir label Aug 7, 2001
    @tim-one tim-one closed this as completed Aug 7, 2001
    @tim-one tim-one added the docs Documentation in the Doc dir label Aug 7, 2001
    @loewis
    Copy link
    Mannequin

    loewis mannequin commented Aug 4, 2002

    Logged In: YES
    user_id=21627

    With the patch attached, this behaviour is cast into stone
    (or, atleast into a SF tracker :)

    @niemeyer
    Copy link
    Mannequin

    niemeyer mannequin commented Nov 26, 2002

    Logged In: YES
    user_id=7887

    I'm attaching a suggested solution for the problem,
    including documentation and reordering of dict evaluation.

    @niemeyer
    Copy link
    Mannequin

    niemeyer mannequin commented Dec 1, 2002

    Logged In: YES
    user_id=7887

    Martin, could you please review the proposed solution?

    @loewis
    Copy link
    Mannequin

    loewis mannequin commented Dec 2, 2002

    Logged In: YES
    user_id=21627

    The patch looks fine, please apply it.

    It would be good to check that Jython meets all your
    expectations in this respect, and that it, in particular,
    executes all the examples in the documentation in the right
    order.

    This change should *not* be backported to 2.2 IMO.

    @niemeyer
    Copy link
    Mannequin

    niemeyer mannequin commented Dec 16, 2002

    Logged In: YES
    user_id=7887

    Martin, I've checked with Jython and the examples are ok as
    well.

    I have applied as:

    Doc/ref/ref5.tex: 1.71
    Python/compile.c: 2.267
    Lib/compiler/pycodegen.py: 1.62
    Misc/NEWS: 1.561

    Thank you!

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    docs Documentation in the Doc dir
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant