Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #76259
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.albasani.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.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.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'parameters': 0.04; 'argument': 0.05; 'position,': 0.05; 'initialize': 0.07; 'level,': 0.07; '*args,': 0.09; 'arguments': 0.09; 'oh,': 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; 'def': 0.12; 'jan': 0.12; '"/"': 0.16; "'/'": 0.16; '**kwargs)': 0.16; 'foo,': 0.16; 'positional': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'subclass': 0.16; 'wrote:': 0.18; 'code.': 0.18; '(the': 0.22; 'header:User- Agent:1': 0.23; 'looks': 0.24; 'pass': 0.26; 'header:X-Complaints- To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'feature': 0.29; 'specified': 0.30; 'spam,': 0.31; 'subject:what': 0.31; 'worked': 0.33; 'skip:_ 10': 0.34; 'subject:the': 0.34; 'could': 0.34; 'but': 0.35; 'next': 0.36; 'example,': 0.37; 'two': 0.37; 'to:addr :python-list': 0.38; 'pm,': 0.38; 'that,': 0.38; 'does': 0.39; 'received:71': 0.39; 'to:addr:python.org': 0.39; 'either': 0.39; 'received:org': 0.40; 'hope': 0.61; 'new': 0.61; 'first': 0.61; 'name': 0.63; 'ethan': 0.84; 'furman': 0.84; 'received:fios.verizon.net': 0.84; 'subject:self': 0.84 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Terry Reedy <tjreedy@udel.edu> |
| Subject | Re: what is the "/" mean in __init__(self, /, *args, **kwargs) ? |
| Date | Thu, 14 Aug 2014 00:03:16 -0400 |
| References | <53EC1887.6060205@gmail.com> <53EC1CD6.4080203@stoneleaf.us> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | pool-71-175-90-87.phlapa.fios.verizon.net |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 |
| In-Reply-To | <53EC1CD6.4080203@stoneleaf.us> |
| 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.12967.1407989035.18130.python-list@python.org> (permalink) |
| Lines | 35 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1407989035 news.xs4all.nl 2895 [2001:888:2000:d::a6]:36856 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:76259 |
Show key headers only | View raw
On 8/13/2014 10:20 PM, Ethan Furman wrote: > 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. In particular, int.__init__(self = <subclass instance>) will not work because 'self' is positional only. (I don't think int.__init__ actually does anything, but a subclass of int might call it.) > 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). I hope / will be valid Python in 3.5. -- Terry Jan Reedy
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: what is the "/" mean in __init__(self, /, *args, **kwargs) ? Terry Reedy <tjreedy@udel.edu> - 2014-08-14 00:03 -0400
csiph-web