2

for example

>>> help(str)


class str(object)
 |  str(object='') -> str
 |  str(bytes_or_buffer[, encoding[, errors]]) -> str
 |  
 |  Create a new string object from the given object. If encoding or
 |  errors is specified, then the object must expose a data buffer
 |  that will be decoded using the given encoding and error handler.
 |  Otherwise, returns the result of object.__str__() (if defined)
 |  or repr(object).
 |  encoding defaults to sys.getdefaultencoding().
 |  errors defaults to 'strict'.
 |  
 |  Methods defined here:
 |  
 |  __add__(self, value, /)
 |      Return self+value.
 |  
 |  __contains__(self, key, /)
 |      Return key in self.
 |  
 |  __eq__(self, value, /)
 |      Return self==value.
 |
 |  capitalize(...)
 |      S.capitalize() -> str

I guess func(args[, a[, b]]) means argument a and b was optional

What puzzled me was the identity of function

what does func(...) mean? How about func(arg, arg, /) the / means?

Barmar
  • 741,623
  • 53
  • 500
  • 612
Rancho
  • 1,988
  • 2
  • 12
  • 12

0 Answers0