6

I was reading the python documentation where I came across elem [,n] this notation for arguments. I have seen such notations in past. Don't just know what they mean. Also, google doesn't support searching brackets.

Petr Janeček
  • 37,768
  • 12
  • 121
  • 145
MeetM
  • 1,410
  • 17
  • 25

3 Answers3

15

The Python documentation has a section about the used notation, which says:

[…] a phrase enclosed in square brackets ([ ]) means zero or one occurrences (in other words, the enclosed phrase is optional).

This notation originates from the Backus–Naur Form (BNF).

Gumbo
  • 643,351
  • 109
  • 780
  • 844
5

It means that the argument so bracketed is optional.

Marcin
  • 48,559
  • 18
  • 128
  • 201
0

Generally this means that the parameter within the square brackets is optional; however, without a link to the specific documentation it's hard to say.

Joel
  • 5,618
  • 1
  • 20
  • 19