Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #9759
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsreader4.netcologne.de!news.netcologne.de!feeder.news-service.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <t@jollybox.de> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.009 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'example:': 0.03; 'arguments': 0.05; 'infinite': 0.07; 'python': 0.08; 'arguments.': 0.09; 'subject:method': 0.09; 'syntax': 0.11; 'am,': 0.13; 'things.': 0.13; 'wrote:': 0.15; '(note:': 0.16; 'blah': 0.16; 'different,': 0.16; 'jumping': 0.16; 'received:192.168.1.40': 0.16; 'subject:function': 0.16; 'subject:syntax': 0.16; 'method.': 0.16; 'def': 0.16; 'slightly': 0.19; 'header:In-Reply-To:1': 0.22; 'encouraging': 0.23; 'interpreted': 0.23; 'in:': 0.25; 'keyword': 0.25; 'suggestion': 0.26; '(and': 0.27; 'pass': 0.28; 'correct': 0.29; 'construct': 0.30; 'does': 0.32; 'actually': 0.33; 'to:addr :python-list': 0.34; 'header:User-Agent:1': 0.34; 'there': 0.34; "can't": 0.34; 'like:': 0.35; '(with': 0.35; 'subject:/': 0.36; 'idea': 0.36; 'error.': 0.36; 'anything': 0.37; 'open': 0.37; 'but': 0.37; 'could': 0.37; 'received:192': 0.38; 'subject:: ': 0.38; 'skip:\xce 10': 0.38; 'something': 0.38; 'received:192.168.1': 0.39; 'ways': 0.39; 'help': 0.39; 'goes': 0.39; 'to:addr:python.org': 0.39; 'called': 0.40; 'your': 0.60; 'order': 0.62; 'received:62': 0.67; 'importantly,': 0.67; '8bit%:100': 0.70; 'objective': 0.77; 'from:addr:t': 0.84; 'idiomatic': 0.84; 'interesting,': 0.84; 'readability': 0.84; 'unreadable,': 0.84; 'points,': 0.91 |
| Date | Mon, 18 Jul 2011 01:19:23 +0200 |
| From | Thomas Jollans <t@jollybox.de> |
| User-Agent | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110626 Iceowl/1.0b2 Icedove/3.1.11 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: Crazy what-if idea for function/method calling syntax |
| References | <e3275985-7cb4-4144-8962-17f0ed4658be@l18g2000yql.googlegroups.com> |
| In-Reply-To | <e3275985-7cb4-4144-8962-17f0ed4658be@l18g2000yql.googlegroups.com> |
| X-Enigmail-Version | 1.1.2 |
| OpenPGP | id=5C8691ED |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | 8bit |
| 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.1194.1310944762.1164.python-list@python.org> (permalink) |
| Lines | 43 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1310944762 news.xs4all.nl 23970 [2001:888:2000:d::a6]:49906 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:9759 |
Show key headers only | View raw
On 07/18/2011 12:54 AM, ΤΖΩΤΖΙΟΥ wrote: > Jumping in: > > What if a construct > > xx(*args1, **kwargs1)yy(*args2, **kwargs2) > > was interpreted as > > xxyy(*(args1+args2), **(kwargs1+kwargs2)) > > (Note: with **(kwargs1+kwargs2) I mean “put keyword arguments in the > order given”, since dicts can't be added) > > This construct is currently a syntax error. The intent of this idea is > to help improve legibility. > > Example: > def place_at(item, x, y): blah blah > could be called as > place(item)_at(x, y) Objective C does something similar. I don't actually know Objective C, but from what I remember from when I briefly read up on in (somebody please correct me), that call could, in Objective C, look something like: [ place:item atPositionX:x Y:y ] The idiomatic Python way for this is the following: def place(item, at): pass place(item, at=(x,y)) Your suggestion would open up an infinite number of different, mostly unreadable, ways to call a single method. This completely goes against the principle of encouraging there being only one way to do things. Multi-part method names (with fixed, non-optional, "split" points, if you know what I mean) are slightly interesting, but don't fit in, and, more importantly, don't add anything to the language: all the possible readability benefits are already provided (and trumped) by keyword arguments.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Crazy what-if idea for function/method calling syntax ΤΖΩΤΖΙΟΥ <tzotzioy@gmail.com> - 2011-07-17 15:54 -0700
Re: Crazy what-if idea for function/method calling syntax Thomas Jollans <t@jollybox.de> - 2011-07-18 01:19 +0200
Re: Crazy what-if idea for function/method calling syntax Cameron Simpson <cs@zip.com.au> - 2011-07-18 12:04 +1000
Re: Crazy what-if idea for function/method calling syntax Ian Kelly <ian.g.kelly@gmail.com> - 2011-07-17 21:29 -0600
Re: Crazy what-if idea for function/method calling syntax Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-07-18 15:54 +1000
Re: Crazy what-if idea for function/method calling syntax Pierre Quentel <pierre.quentel@gmail.com> - 2011-07-18 13:34 -0700
csiph-web