Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #9775
| Date | 2011-07-18 12:04 +1000 |
|---|---|
| From | Cameron Simpson <cs@zip.com.au> |
| Subject | Re: Crazy what-if idea for function/method calling syntax |
| References | <e3275985-7cb4-4144-8962-17f0ed4658be@l18g2000yql.googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1200.1310954676.1164.python-list@python.org> (permalink) |
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 | 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