Crazy what-if idea for function/method calling syntax

Ian Kelly ian.g.kelly at
Mon Jul 18 05:29:45 CEST 2011

2011/7/17 ΤΖΩΤΖΙΟΥ <tzotzioy at>:
> 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)

Then you can do:

place(item).at(x, y)

No syntax changes required. :-)

More information about the Python-list mailing list