Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #36701
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!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; 'else:': 0.03; 'syntax': 0.03; 'calls.': 0.07; 'python': 0.09; '40,': 0.09; 'positional': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 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; 'from:addr:behnel.de': 0.16; 'from:addr:stefan_ml': 0.16; 'from:name:stefan behnel': 0.16; 'oct': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'syntactic': 0.16; 'stefan': 0.17; '>>>': 0.18; 'example': 0.23; 'idea': 0.24; 'header:In- Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'header:X -Complaints-To:1': 0.28; 'subject:list': 0.28; 'proposing': 0.29; 'function': 0.30; 'implement': 0.32; 'received:84': 0.32; 'could': 0.32; 'to:addr:python-list': 0.33; 'received:org': 0.36; 'but': 0.36; 'should': 0.36; 'turn': 0.36; 'subject:: ': 0.38; 'object': 0.38; 'sure': 0.38; 'to:addr:python.org': 0.39; 'little': 0.39; 'header:Received:5': 0.40; 'think': 0.40; 'easy': 0.60; 'relatively': 0.62; 'more': 0.63; 'received:arcor-ip.net': 0.84; 'received:pools.arcor-ip.net': 0.84 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Stefan Behnel <stefan_ml@behnel.de> |
| Subject | Re: proposal: Ellipsis in argument list |
| Date | Sat, 12 Jan 2013 15:08:24 +0100 |
| References | <CAHDqXQ_Rw9owJN1nNqCeT24TPQnMPdtnrnf19wDX2h8jyhteRg@mail.gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | 8bit |
| X-Gmane-NNTP-Posting-Host | dslb-084-056-008-205.pools.arcor-ip.net |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0 |
| In-Reply-To | <CAHDqXQ_Rw9owJN1nNqCeT24TPQnMPdtnrnf19wDX2h8jyhteRg@mail.gmail.com> |
| 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 | <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.446.1357999722.2939.python-list@python.org> (permalink) |
| Lines | 34 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1357999722 news.xs4all.nl 6849 [2001:888:2000:d::a6]:47711 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:36701 |
Show key headers only | View raw
Szabolcs Blága, 12.01.2013 14:30: > 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". Not sure what exactly you are proposing here, this works for me: Python 3.2.3 (default, Oct 19 2012, 19:53:16) [GCC 4.7.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> def f(*args): print(args) >>> f(34, ..., 43) (34, Ellipsis, 43) Stefan
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: proposal: Ellipsis in argument list Stefan Behnel <stefan_ml@behnel.de> - 2013-01-12 15:08 +0100
csiph-web