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


Groups > comp.lang.python > #9775

Re: Crazy what-if idea for function/method calling syntax

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!zen.net.uk!dedekind.zen.co.uk!tudelft.nl!txtfeed1.tudelft.nl!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <cameron@cskk.homeip.net>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'example:': 0.03; 'arguments': 0.05; 'received:edu.au': 0.07; 'subject:method': 0.09; 'syntax': 0.11; 'wrote:': 0.15; '(note:': 0.16; 'ambiguous': 0.16; 'blah': 0.16; 'examples.': 0.16; 'from:addr:cs': 0.16; 'from:addr:zip.com.au': 0.16; 'from:name:cameron simpson': 0.16; 'message-id:@cskk.homeip.net': 0.16; 'received:202.125.174': 0.16; 'received:202.125.174.133': 0.16; 'received:boardofstudies.nsw.edu.au': 0.16; 'received:cskk.homeip.net': 0.16; 'received:harvey.boardofstudies.nsw.edu.au': 0.16; 'received:homeip.net': 0.16; 'received:nsw.edu.au': 0.16; 'subject:function': 0.16; 'subject:syntax': 0.16; 'type:': 0.16; 'underscores,': 0.16; 'cc:addr:python-list': 0.16; 'def': 0.16; '(i.e.': 0.17; 'cheers,': 0.19; 'cc:2**0': 0.21; 'cc:no real name:2**0': 0.22; 'header:In-Reply-To:1': 0.22; 'interpreted': 0.23; 'keyword': 0.25; 'later': 0.26; 'function': 0.26; 'paul': 0.28; 'problem': 0.29; 'cc:addr:python.org': 0.30; 'construct': 0.30; 'error': 0.31; 'break': 0.33; 'rather': 0.33; 'instead': 0.34; 'header:User-Agent:1': 0.34; 'there': 0.34; "can't": 0.34; 'subject:/': 0.36; 'idea': 0.36; 'error.': 0.36; 'received:au': 0.36; 'but': 0.37; 'could': 0.37; 'another': 0.38; 'subject:: ': 0.38; 'skip:\xce 10': 0.38; 'difficult': 0.39; 'help': 0.39; 'under': 0.39; 'might': 0.39; 'called': 0.40; 'your': 0.60; 'easily': 0.61; 'order': 0.62; '8bit%:23': 0.62; 'immediate': 0.65; 'received:202': 0.66; 'cameron': 0.67; '8bit%:100': 0.70; 'imagine': 0.71; 'skip:\xe2 10': 0.71; 'hybrid': 0.84; 'inclusion': 0.84; 'misuse': 0.91
Date Mon, 18 Jul 2011 12:04:24 +1000
From Cameron Simpson <cs@zip.com.au>
To ΤΖΩΤΖΙΟΥ <tzotzioy@gmail.com>@cskk.homeip.net
Subject Re: Crazy what-if idea for function/method calling syntax
MIME-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Disposition inline
Content-Transfer-Encoding 8bit
In-Reply-To <e3275985-7cb4-4144-8962-17f0ed4658be@l18g2000yql.googlegroups.com>
User-Agent Mutt/1.5.21 (2010-09-15)
References <e3275985-7cb4-4144-8962-17f0ed4658be@l18g2000yql.googlegroups.com>
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.1200.1310954676.1164.python-list@python.org> (permalink)
Lines 46
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1310954676 news.xs4all.nl 23854 [2001:888:2000:d::a6]:54928
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:9775

Show key headers only | View raw


On 17Jul2011 15:54, ΤΖΩΤΖΙΟΥ <tzotzioy@gmail.com> wrote:
| 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)
[...]
| There is also a big window for misuse (i.e. break the function/method
| name in illogical places), but I would classify this under “consenting
| adults”. It might be suggested as good form that function names break
| at underscores, like my examples.

Another problem is the scope for error. I can easily imagine typing:

  x=foo(x)bah(y)

when I intended to type:

  x=foo(x)+bah(y)

Adding your syntax causes silent breakage later instead of immediate
syntax error now.

Cheers,
-- 
Cameron Simpson <cs@zip.com.au> DoD#743
http://www.cskk.ezoshosting.com/cs/

hybrid rather than pure; compromising rather than clean;
distorted rather than straightforward; ambiguous rather than
articulated; both-and rather than either-or; the difficult
unity of inclusion rather than the easy unity of exclusion.
        - Paul Barton-Davis <pauld@cs.washington.edu>

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


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