Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #9777
| References | <e3275985-7cb4-4144-8962-17f0ed4658be@l18g2000yql.googlegroups.com> |
|---|---|
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | 2011-07-17 21:29 -0600 |
| Subject | Re: Crazy what-if idea for function/method calling syntax |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1201.1310959816.1164.python-list@python.org> (permalink) |
2011/7/17 ΤΖΩΤΖΙΟΥ <tzotzioy@gmail.com>:
> 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)
class place(object):
def __init__(self, item):
self.__item = item
def at(self, x, y):
# place self.__item at (x, y)
pass
Then you can do:
place(item).at(x, y)
No syntax changes required. :-)
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