Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.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.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'args': 0.05; 'type,': 0.07; 'am,': 0.12; 'def': 0.13; 'skip:f 30': 0.13; 'kwargs,': 0.16; 'solves': 0.16; 'subject:syntax': 0.16; 'unpack': 0.16; 'cc:addr:python-list': 0.16; 'mon,': 0.16; 'received:74.125.82.44': 0.16; 'received:mail-ww0-f44.google.com': 0.16; 'wrote:': 0.18; 'have:': 0.18; 'that?': 0.18; 'cc:no real name:2**0': 0.20; 'dec': 0.22; 'header:In-Reply-To:1': 0.22; 'defined': 0.24; 'cc:2**0': 0.24; 'function': 0.27; 'message- id:@mail.gmail.com': 0.28; 'cc:addr:python.org': 0.29; 'definition': 0.30; 'semantics': 0.30; 'does': 0.32; 'this.': 0.33; 'received:74.125.82': 0.35; 'instead,': 0.37; 'but': 0.37; 'received:74.125': 0.37; 'received:google.com': 0.37; 'some': 0.38; 'either': 0.39; '2011': 0.61; 'back': 0.62; 'fall': 0.64; '11:51': 0.84; 'definition:': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=O6lj+kuW5GCqt0wkDzCDqMmqoUmp5B0aJ+tZIZtf+w8=; b=s6kGCuYA35/LUH4iefkBznkoODi/PZc+H5t4UGQq7XWZcWvdbFa11jVDT18Ax99jm8 onpEMlPG+Adq3usbRI5iYEYq8BkvdV2ZFWOdnVeaXL5x5shCw7tZ4ygwyV3Sh7/smeFZ MuGcQvxIxKGEsgxwXCDFXVTOhx5BF2f93D1ng= MIME-Version: 1.0 In-Reply-To: References: <4ee554a3$0$11091$c3e8da3@news.astraweb.com> <5de94e20-314e-4185-ba8f-75e54f87968e@d10g2000vbk.googlegroups.com> <1a159184-9262-4b66-88e8-a5b68964d8d7@q16g2000yqn.googlegroups.com> From: Ian Kelly Date: Mon, 12 Dec 2011 17:34:25 -0700 Subject: Re: Verbose and flexible args and kwargs syntax To: Eelco Content-Type: text/plain; charset=ISO-8859-1 Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 21 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1323736499 news.xs4all.nl 6868 [2001:888:2000:d::a6]:41751 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:17092 On Mon, Dec 12, 2011 at 11:51 AM, Eelco wrote: > Either way, its not hard to add some detail to the semantics to allow > all this. Even this function definition: > > def func(Foo(args), Foo(kwargs)) > > ...could even be defined unambigiously by overloading first on base > type, and if that does not uniquely determine the args and kwargs, > fall back on positionality, so that: > > def func(Foo(args), dict(kwargs)) > def func(list(args), Foo(kwargs)) > > would be uniquely defined as well. That solves some of the problems, but if I just have: def func(SequenceOrMappingType(args)): That's going to unpack positionally. If I want it to unpack keywords instead, how would I change the definition to indicate that?