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


Groups > comp.lang.python > #17054

Re: Verbose and flexible args and kwargs syntax

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <arnodel@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'terry': 0.07; '>>>>': 0.09; '(1,': 0.16; '(b,': 0.16; '3],': 0.16; '[2,': 0.16; 'a,b,c': 0.16; 'general.': 0.16; 'reedy': 0.16; 'sequence.': 0.16; 'subject:syntax': 0.16; 'unpacking': 0.16; 'unpacking.': 0.16; 'cc:addr:python-list': 0.16; 'wrote:': 0.18; '>>>': 0.18; 'jan': 0.19; 'cc:no real name:2**0': 0.20; 'header:In-Reply-To:1': 0.22; 'cc:2**0': 0.24; 'specifically': 0.27; 'message- id:@mail.gmail.com': 0.28; 'cc:addr:python.org': 0.29; 'cases.': 0.30; 'quite': 0.32; 'nested': 0.34; 'received:209.85.161': 0.36; 'but': 0.37; 'received:google.com': 0.37; 'received:209.85': 0.38; 'useful': 0.38; 'received:209': 0.40; 'more': 0.61; '2011': 0.61; 'specialized': 0.72
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=g++KeVGWCdaK/pgLUQotfiV43mx6w3aP+eZmF1wTW/A=; b=JNoCRl+ghpvCvvaaI6pDyrLFg2EAjK1FWura6Hgs4+5q8pn53FifoGJYwn85Gl0AZT uPpvImOx72t90WItmzbhbsim+7Z+BN/dzd9qj7awFr1+7xzNrVCI/uG2VRNihZI1Xa0v oecULSG9jVI1ybaIK6q/7+MFWz9xx4jDSECqg=
MIME-Version 1.0
In-Reply-To <jc57vr$k15$1@dough.gmane.org>
References <4EE5C576.2000307@gmail.com> <jc57vr$k15$1@dough.gmane.org>
Date Mon, 12 Dec 2011 16:10:00 +0000
Subject Re: Verbose and flexible args and kwargs syntax
From Arnaud Delobelle <arnodel@gmail.com>
To Terry Reedy <tjreedy@udel.edu>
Content-Type text/plain; charset=UTF-8
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 <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3552.1323706204.27778.python-list@python.org> (permalink)
Lines 26
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1323706204 news.xs4all.nl 6985 [2001:888:2000:d::a6]:33684
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:17054

Show key headers only | View raw


On 12 December 2011 15:52, Terry Reedy <tjreedy@udel.edu> wrote:

> No, *target unpacking (singular) is quite useful in specialized cases. But
> it is not specifically head/tail unpacking.
>
>>>> a,*b,c = 1,2,3,4,5,6
>>>> a,b,c
> (1, [2, 3, 4, 5], 6)
>>>> *a,b,c = 1,2,3,4,5
>>>> a,b,c
> ([1, 2, 3], 4, 5)
>
>> I personally quite like them, but I would like them to be more general.
>
>
> It already is. The *target can be anywhere in the sequence.
>
> --
> Terry Jan Reedy

You can even have nested sequences!

>>> a, (b, *c), *d = 1, "two", 3, 4

-- 
Arnaud

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


Thread

Re: Verbose and flexible args and kwargs syntax Arnaud Delobelle <arnodel@gmail.com> - 2011-12-12 16:10 +0000

csiph-web