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


Groups > comp.lang.python > #76247

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

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.005
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'initialize': 0.07; '*args,': 0.09; '2004': 0.09; 'arguments': 0.09; 'expectation': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; '"/"': 0.16; '**kwargs)': 0.16; 'before.': 0.16; 'finney': 0.16; 'placeholder': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'code.': 0.18; "python's": 0.19; '>>>': 0.22; 'header:User-Agent:1': 0.23; "haven't": 0.24; 'least': 0.26; 'header:X-Complaints-To:1': 0.27; 'function': 0.29; "doesn't": 0.30; "i'm": 0.30; 'that.': 0.31; 'subject:what': 0.31; 'writes:': 0.31; 'implemented': 0.33; 'skip:_ 10': 0.34; 'subject:the': 0.34; 'something': 0.35; 'but': 0.35; 'useful': 0.36; 'ben': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'even': 0.60; 'skip:* 10': 0.61; 'more': 0.64; 'holding': 0.65; 'between': 0.67; '8bit%:21': 0.69; 'day': 0.76; 'received:125': 0.84; 'subject:self': 0.84; 'faith': 0.91
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Ben Finney <ben+python@benfinney.id.au>
Subject Re: what is the "/" mean in __init__(self, /, *args, **kwargs) ?
Date Thu, 14 Aug 2014 12:08:16 +1000
References <53EC1887.6060205@gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 8bit
X-Gmane-NNTP-Posting-Host jigong.madmonks.org
X-Public-Key-ID 0xAC128405
X-Public-Key-Fingerprint 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405
X-Public-Key-URL http://www.benfinney.id.au/contact/bfinney-pubkey.asc
X-Post-From Ben Finney <bignose+hates-spam@benfinney.id.au>
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)
Cancel-Lock sha1:781v2spmxtmN6y4MYbWbY4d1osI=
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.12956.1407982114.18130.python-list@python.org> (permalink)
Lines 30
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1407982114 news.xs4all.nl 2892 [2001:888:2000:d::a6]:44500
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:76247

Show key headers only | View raw


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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web