On 08/13/2014 07:01 PM, luofeiyu wrote:
help(int.__init__)
Help on wrapper_descriptor:

__init__(self, /, *args, **kwargs)
     Initialize self.  See help(type(self)) for accurate signature.

what is the "/" mean in __init__(self, /, *args, **kwargs) ?

The '/' means that all arguments before it must be positional only. This looks like an artifact of the new Argument Clinic for C code.

For example, if this also worked at the Python level, you could say:

   def some_func(this, that, /, spam, eggs, *, foo, bar):
      pass

Meaning that the first two parameters could not be specified by name, the next two could be either name or position, and the last two by name only.

Oh, and the * is valid Python now (the / is not -- it's solely a documentation 
feature at this point).

--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to