Crazy what-if idea for function/method calling syntax

Cameron Simpson cs at
Sun Jul 17 22:04:24 EDT 2011

On 17Jul2011 15:54, ΤΖΩΤΖΙΟΥ <tzotzioy at> 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:


when I intended to type:


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

Cameron Simpson <cs at> DoD#743

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 at>

More information about the Python-list mailing list