Path: csiph.com!usenet.pasdenom.info!news.albasani.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'english.': 0.04; '21,': 0.07; 'args': 0.07; 'arguments': 0.09; 'lawrence': 0.09; 'subject:None': 0.09; 'cc:addr:python-list': 0.11; 'def': 0.12; 'accepts': 0.16; 'foo,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'positional': 0.16; 'subject:key': 0.16; 'them.)': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'bit': 0.19; '>>>': 0.22; 'cc:addr:python.org': 0.22; 'refers': 0.24; 'cc:2**0': 0.24; 'sort': 0.25; 'pass': 0.26; 'header:In- Reply-To:1': 0.27; 'dec': 0.30; 'specified': 0.30; 'message- id:@mail.gmail.com': 0.30; 'url:python': 0.33; 'fri,': 0.33; 'plain': 0.33; 'but': 0.35; 'received:google.com': 0.35; "didn't": 0.36; 'method': 0.36; 'url:org': 0.36; 'requirements': 0.37; 'two': 0.37; 'list': 0.37; 'same.': 0.38; 'url:library': 0.38; 'pm,': 0.38; 'url:3': 0.61; 'simply': 0.61; 'here': 0.66; 'believe': 0.68; '20,': 0.68; 'subject': 0.69; 'default': 0.69; 'repeat': 0.74; 'to:none': 0.92; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=i51yTU0VsOcpCr8SE7q1wgSNRXdcNA4Gjoe5f2VaLQ4=; b=ZuQ6xFW8jCOSLy9JOmE9n3DQK7KSIEDewbxU2hNU4BgkTl6/VVl1h6opVRk1YFWwde KwqaYwitsPSHltTuJR1XFzmukaP4PTmhv6m/Yj7vXoa/5b6c6+UFRiiF21UGn6n+JDAc KM8nxCaUzQ6ii4x8BHE9MNwI5jSPC5Z1WREbDBHJETfMsMpcvVTWnnLmBleaMXaO15g2 VevLr5+9l8jifNT3u6vnOtdaQlCXv3TWBksnFKhaP6oiOt0X19ZIej4BvcyN3nKuWv5c N3O0BkMWwmQLXzfyY73Phdox1qAf3mCZLICEa/ElXxBqFCPm3A52A3IpjgIxjYJFWQpT IsQA== MIME-Version: 1.0 X-Received: by 10.68.108.194 with SMTP id hm2mr13719473pbb.22.1387611320140; Fri, 20 Dec 2013 23:35:20 -0800 (PST) In-Reply-To: References: Date: Sat, 21 Dec 2013 18:35:20 +1100 Subject: Re: sort(*, key=None, reverse=None) From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 31 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1387611323 news.xs4all.nl 2839 [2001:888:2000:d::a6]:58254 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:62471 On Sat, Dec 21, 2013 at 6:24 PM, Mark Lawrence wrote: > On 21/12/2013 07:20, Devin Jeanpierre wrote: >> >> On Fri, Dec 20, 2013 at 11:16 PM, Mark Lawrence >> wrote: >>> >>> The subject refers to the list sort method given here >>> http://docs.python.org/3/library/stdtypes.html#list. I believe that the >>> "*," bit is simply a typo, given that the docs also state "sort() accepts >>> two arguments that can only be passed by keyword". Am I correct? >> >> >> It's good practice in technical writing to repeat yourself: once in >> the formal spec, and once in plain english. I don't see why this would >> be a typo. >> >> -- Devin >> > > So what is it actually saying? def func(x, y, *moreargs, foo, bar): pass Any positional args after x and y will go into moreargs, so foo and bar have to be specified by keywords. (And are mandatory, since I didn't default them.) If moreargs isn't given a name, then additional positional args are forbidden, but the requirements on foo and bar are the same. ChrisA