0

Since the first times I started to study Python I met many schematic codes such as

pickle.dump(obj, file[, protocol]) 

Now in this example I can understand the meaning of the first comma, as it separate two different arguments to be inserted in a method, but I don't understand the second comma that is located after a square bracket. Is there anyone who can explain me the meaning of this comma?

Oliver Charlesworth
  • 267,707
  • 33
  • 569
  • 680
Stefano Fedele
  • 6,877
  • 9
  • 29
  • 48

1 Answers1

0

it's a common notation for indicating the next argument is optional. so you could write:

pickle.dump(obj, file)

or you could write:

pickle.dump(obj, file, protocol)

if you see angle brackets like <foo>, that is used to indicate the argument is required.

Mike Frysinger
  • 2,827
  • 1
  • 21
  • 26