Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2.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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'else:': 0.03; 'received:209.85.223': 0.03; 'syntax': 0.03; 'calls.': 0.07; '40,': 0.09; 'positional': 0.09; 'useless': 0.09; 'def': 0.10; '"..."': 0.16; '...,': 0.16; '36,': 0.16; '37,': 0.16; '39,': 0.16; '42,': 0.16; 'argument.': 0.16; 'ellipsis': 0.16; 'syntactic': 0.16; 'all,': 0.21; 'example': 0.23; 'idea': 0.24; 'message-id:@mail.gmail.com': 0.27; 'subject:list': 0.28; 'skip:& 10': 0.29; 'function': 0.30; 'implement': 0.32; 'could': 0.32; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'received:209.85': 0.35; 'but': 0.36; 'should': 0.36; 'turn': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'object': 0.38; 'to:addr:python.org': 0.39; 'little': 0.39; 'think': 0.40; 'easy': 0.60; 'relatively': 0.62; 'dear': 0.66 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:from:date:message-id:subject:to :content-type; bh=Zp0glKdpN8bdpwvovYfBnFP7M7vtDhS+5aRvzNrnWJw=; b=qIDwnLE5GYHbjGlssLhO08kpXsyVh8CSnKEYwaTmSTKpDraY4bDrta91CX/gtRwfT2 ZvozVhMos8PFHvjXdhkv0/PBomP8LbklWkNEYfG+V02ZpBuD13FsoVb+MPaQaXFCkw1+ lSGOXhv2MLfO9drPiE8NcaXGvUZQCpPW+85EGAy0KDZfNzJp62dTxdWOjXN5iOF2lsQR EbFxXOMUGX0r3oZnRae60t1J1lq8jkn6ErnBK6dUe74/OcI5u+dJ8XKPpA2lqldSY2Jm ZwNatXxzWLfzY54789VkIwPCaUWMeIrmIGIivq8rIGZ+sbTBjeMKfh2UowVIQZiqx3hT 0oZg== X-Received: by 10.50.220.199 with SMTP id py7mr2179587igc.34.1357997433529; Sat, 12 Jan 2013 05:30:33 -0800 (PST) MIME-Version: 1.0 From: =?UTF-8?Q?Szabolcs_Bl=C3=A1ga?= Date: Sat, 12 Jan 2013 14:30:03 +0100 Subject: proposal: Ellipsis in argument list To: python-list@python.org Content-Type: multipart/alternative; boundary=f46d0434bdd2a1a72f04d3176ab8 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: 56 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1357997442 news.xs4all.nl 6894 [2001:888:2000:d::a6]:40263 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:36700 --f46d0434bdd2a1a72f04d3176ab8 Content-Type: text/plain; charset=UTF-8 Dear All, I have an idea that the Ellipsis object could be used in function calls. The "..." syntax should automagically turn into an Ellipsis positional argument. def f(*args): ext_args = [] for i, a in enumerate(args): if a is Ellipsis: ext_args.extend([x for x in range(args[i-1]-1, args[i+1])]) else: ext_args.append(a) return ext_args Calling it for the above example specifically: >>>f(34, ..., 43) [34, 35, 36, 37, 38, 39, 40, 41, 42, 43] That might be useless or someone might say it is confusing, but I think it would be relatively easy to implement and a nice little syntactic "sugar". Best regards, Szabolcs Blaga --f46d0434bdd2a1a72f04d3176ab8 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Dear All,

I have an idea that the Ellipsis object could = be used in function calls. The "..." syntax should automagically = turn into an Ellipsis positional argument.

def f(*= args):
=C2=A0 ext_args =3D []
=C2=A0 for i, a in enumerate(args):
=C2=A0 =C2=A0 if a is Ellipsis:
=C2=A0 =C2=A0 =C2=A0 ext= _args.extend([x for x in range(args[i-1]-1, args[i+1])])
=C2=A0 = =C2=A0 else:
=C2=A0 =C2=A0 =C2=A0 ext_args.append(a)
=C2=A0 return ext_args

Calling it for the abo= ve example specifically:

>>>f(34, ..., 43= )
[34, 35, 36, 37, 38, 39, 40, 41, 42, 43]

That might be useless or someone might say it is confusing, but I think it = would be relatively easy to implement and a nice little syntactic "sug= ar".

Best regards,

Szabolcs Blaga
--f46d0434bdd2a1a72f04d3176ab8--