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.
Asked
Active
Viewed 1,315 times
6

Petr Janeček
- 37,768
- 12
- 121
- 145

MeetM
- 1,410
- 17
- 25
-
http://docs.python.org/3.4/library/itertools.html Same use of brackets here. – Jeremy Cochoy Jul 19 '13 at 17:49
-
related: [How to read API documentation](http://stackoverflow.com/q/10925478/1048572) – Bergi Mar 07 '15 at 18:16
3 Answers
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
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