GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Unpacking without parentheses is allowed since 3.9 · Issue #90881 · python/cpython

Unpacking without parentheses is allowed since 3.9 #90881

New issue
Copy link
New issue
Copy link
Closed
Closed
Unpacking without parentheses is allowed since 3.9#90881
Copy link
Labels
3.10 (EOL)end of lifeend of life3.11only security fixesonly security fixes3.9 (EOL)end of lifeend of lifeinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)

Description

@pablogsal
pablogsal
opened on Feb 11, 2022
Issue body actions
BPO 46725
Nosy @gvanrossum, @terryjreedy, @jwilk, @serhiy-storchaka, @JelleZijlstra, @lysnikolaou, @pablogsal, @miss-islington, @isidentical, @erlend-aasland
PRs
  • bpo-46725: Document starred expressions in for statements #31481
  • 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 2022-02-22.18:31:20.414>
    created_at = <Date 2022-02-11.18:10:30.648>
    labels = ['interpreter-core', '3.9', '3.10', '3.11']
    title = 'Unpacking without parentheses is allowed since 3.9'
    updated_at = <Date 2022-02-22.18:31:20.413>
    user = 'https://github.com/pablogsal'

    bugs.python.org fields:

    activity = <Date 2022-02-22.18:31:20.413>
    actor = 'pablogsal'
    assignee = 'none'
    closed = True
    closed_date = <Date 2022-02-22.18:31:20.414>
    closer = 'pablogsal'
    components = ['Parser']
    creation = <Date 2022-02-11.18:10:30.648>
    creator = 'pablogsal'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 46725
    keywords = ['patch']
    message_count = 11.0
    messages = ['413089', '413090', '413091', '413092', '413098', '413101', '413501', '413507', '413698', '413703', '413718']
    nosy_count = 10.0
    nosy_names = ['gvanrossum', 'terry.reedy', 'jwilk', 'serhiy.storchaka', 'JelleZijlstra', 'lys.nikolaou', 'pablogsal', 'miss-islington', 'BTaskaya', 'erlendaasland']
    pr_nums = ['31481']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue46725'
    versions = ['Python 3.9', 'Python 3.10', 'Python 3.11']

    Activity

    1. pablogsal commented on Feb 11, 2022

      @pablogsal
      pablogsal
      on Feb 11, 2022
      MemberAuthor
      More actions

      Seems that this is allowed since the PEG parser rewrite:

      for x in *a, *b:
          print(x)

      but I cannot find anywhere were we discussed this. I am not sure if we should keep it or treat it as a bug and fix it.

    2. pablogsal
      added
      3.9 (EOL)end of lifeend of life
      3.10 (EOL)end of lifeend of life
      3.11only security fixesonly security fixes
      interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)
      on Feb 11, 2022
    3. isidentical commented on Feb 11, 2022

      @isidentical
      isidentical
      on Feb 11, 2022
      SponsorMember
      More actions

      Since this was already allowed in 3.9 and 3.10 stable relases, and since it is consistent with the RHS of an assignment (something = *a, *b); I'd lean towards keeping it (and maybe fixing the old parser's grammar to reflect that) and documenting this.

      Reacted by Kreusada
    4. JelleZijlstra commented on Feb 11, 2022

      @JelleZijlstra
      JelleZijlstra
      on Feb 11, 2022
      Member
      More actions

      I'd lean towards keeping this syntax:

      • It's already been out for two releases, so there's user code out there relying on it. (In fact we found out about this because somebody complained that Black's parser couldn't handle this code.)
      • The syntax isn't obviously confusing and the meaning is clear.
      • It's not hard to parse; it was easy to adjust Black's parser to allow it.
      Reacted by William Andrea
    5. erlend-aasland commented on Feb 11, 2022

      @erlend-aasland
      erlend-aasland
      on Feb 11, 2022
      Contributor
      More actions

      +1 (what Jelle said)

    6. gvanrossum commented on Feb 11, 2022

      @gvanrossum
      gvanrossum
      on Feb 11, 2022
      Member
      More actions

      Let's just document it for 3.11.

      Reacted by jmwielandt, Thomas Grainger, Vibhakar Solanki, Medardo Antonio Rodriguez, jh4mit, Jongwook Choi, Kolen Afix, Nikita Kurpas, Vishesh Panchal, Herman Beeksma and 1 more
    7. pablogsal commented on Feb 11, 2022

      @pablogsal
      pablogsal
      on Feb 11, 2022
      MemberAuthor
      More actions

      Will prepare a PR

    8. terryjreedy commented on Feb 18, 2022

      @terryjreedy
      terryjreedy
      on Feb 18, 2022
      Member
      More actions

      Allowing no parentheses is also consistent with the following:
      for x in 1,2,3: print(x)

    9. gvanrossum commented on Feb 18, 2022

      @gvanrossum
      gvanrossum
      on Feb 18, 2022
      Member
      More actions

      Adding jwilk back (a bpo interaction with browser form caching makes this happen frequently).

      Reacted by Surya
    10. serhiy-storchaka commented on Feb 22, 2022

      @serhiy-storchaka
      serhiy-storchaka
      on Feb 22, 2022
      Member
      More actions

      What exactly was happened? What rule was changed? Can it cause other changes which allow ambiguous code or change semantic?

    11. pablogsal commented on Feb 22, 2022

      @pablogsal
      pablogsal
      on Feb 22, 2022
      MemberAuthor
      More actions

      What happened is that the new grammar using the PEG parser used the equivalent of starred_testlist instead of testlist for the iterable list of for statements.

      The only extra thing allowed is starred elements, that are interpreted as if you are building a tuple without parentheses.

    12. miss-islington commented on Feb 22, 2022

      @miss-islington
      miss-islington
      on Feb 22, 2022
      Contributor
      More actions

      New changeset 7fb94fd by Pablo Galindo Salgado in branch 'main':
      bpo-46725: Document starred expressions in for statements (GH-31481)
      7fb94fd

    13. pablogsal
      closed this as completedon Feb 22, 2022
    14. pablogsal
      closed this as completedon Feb 22, 2022
    15. ezio-melotti
      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

      3.10 (EOL)end of lifeend of life3.11only security fixesonly security fixes3.9 (EOL)end of lifeend of lifeinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions

        You are visitor 01402503 — GeezerVison does not store the pages you look up.
        Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.