Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #76247 > unrolled thread

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

Started byBen Finney <ben+python@benfinney.id.au>
First post2014-08-14 12:08 +1000
Last post2014-08-14 12:08 +1000
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: what is the "/" mean in __init__(self, /, *args, **kwargs) ? Ben Finney <ben+python@benfinney.id.au> - 2014-08-14 12:08 +1000

#76247 — Re: what is the "/" mean in __init__(self, /, *args, **kwargs) ?

FromBen Finney <ben+python@benfinney.id.au>
Date2014-08-14 12:08 +1000
SubjectRe: what is the "/" mean in __init__(self, /, *args, **kwargs) ?
Message-ID<mailman.12956.1407982114.18130.python-list@python.org>
luofeiyu <elearn2014@gmail.com> writes:

> >>> 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) ?

I don't know, I haven't seen that before. It is confusing.

At least it is acknowledged (“See [elsewhere] for accurate signature”)
to be unhelpful.

I suspect this is an artefact of the impedance mismatch between Python
function signatures and the implementation of ‘int’ in C code. The “/”
may be a placeholder for something the C implementation requires but
that Python's function signature expectation doesn't allow.

Perhaps Python 3's keyword-only arguments may one day help functions
like that get implemented with a more useful signature, but I'm not
holding my breath for that.

-- 
 \         “Religious faith is the one species of human ignorance that |
  `\     will not admit of even the *possibility* of correction.” —Sam |
_o__)                                 Harris, _The End of Faith_, 2004 |
Ben Finney

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web