Skip to content

Allow initial comma #1867

Closed
Closed
@rpuntaie

Description

@rpuntaie

Allow initial comma.

Final comma works:

t = (
     1,
     2,
    )
x = [
     1,
     2,
    ]
y = {
     1,
     2,
    }
z = {
     1:11,
     2:22,
    }
def fun(
      a,
      b,
     ):
      pass

Initial comma does not work:

t = (
     , 1
     , 2
    )
x = [
     , 1
     , 2
    ]
y = {
     , 1
     , 2
     }
z = {
     , 1:11
     , 2:22
     }
def fun(
     , a
     , b
     ):
      pass

To make the syntax symmetric in this regard
gives more freedom to format the code.

I occasionally found the restriction an unnecessary nuisance.

Before writing a PEP,
I would like to discuss,

  • whether something like that has been proposed already?
  • what counter-arguments there could be?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions