[Python-3000] 100% backwards compatible parenless function call statements

Blake Winton bwinton at latte.ca
Tue Aug 14 03:48:41 CEST 2007


Chris Monsanto wrote:
> so those uncomfortable with 
> this (basic) idea can continue to use parens in their function calls. 

But we would have to read people's code who didn't use them.

> my_func2 # call other function
> my_func2() # call it again

So, those two are the same, but these two are different?
print my_func2
print my_func2()

What about these two?
x.y().z
x.y().z()

Would this apply to anything which implements callable?

> # Method call?
> f = open("myfile")
> f.close

What happens in
for x in dir(f):
     x
?  If some things are functions, do they get called and the other things 
don't?

> --Pros:--
> 1) Removes unnecessary verbosity for the majority of situations.

"unnecessary verbosity" is kind of stretching it.  Two whole characters 
in some situations is hardly a huge burden.

> I'm willing to write up a proper PEP if anyone is interested in the 
> idea. I figured I'd poll around first.

I vote "AAAAAAaaaahhhh!  Dear god, no!".  ;)

Seriously, knowing at a glance the difference between function 
references and function invocations is one of the reasons I like Python 
(and dislike Ruby).  Your proposal would severely compromise that 
functionality.

Later,
Blake.


More information about the Python-3000 mailing list