why brackets & commas in func calls can't be ommited? (maybe it could be PEP?)
Bruno Desthuilliers
bruno.42.desthuilliers at wtf.websiteburo.oops.com
Wed Mar 21 13:03:58 EDT 2007
dmitrey a écrit :
> Hi all,
> I looked to the PEPs & didn't find a proposition to remove brackets &
> commas for to make Python func call syntax caml- or tcl- like: instead
> of
> result = myfun(param1, myfun2(param5, param8), param3)
> just make possible using
> result = myfun param1 (myfun2 param5 param8) param3
>
> it would reduce length of code lines
Not by a noticeable amount
> and make them more readable,
I guess it's a matter of personal taste, experience with other languages
and whatnot, but as far a I'm concerned, I find the actual syntax more
readable - I don't have to think twice to know that it's a function call
and what are the params.
Also, and FWIW, in Python, the parens are the call operator. Given that
a function may return another function, how would you handle the
following case:
result = my_hof(foo, bar)(baaz)
And while where at it, since Python functions are first class objects,
how would you handle this other case:
def somefunc(arg):
return 2 * arg
alias = somefunc
# some code here
result = alias(42)
> + no
> needs to write annoing charecters.
Could it be that these 'annoying characters' have a good reason to be
here ? Strange as it might be, Python has not been built randomly.
> Maybe it will require more work than I suppose,
Probably, yes.
> but anyway I think it worth.
So try to solve the above problems and come back here with an example
working implementation.
> + it will not yield incompabilities with previous Python versions.
Hmmm. I would not bet my life on this...
More information about the Python-list
mailing list