Naked function call syntax

Bengt Richter bokr at
Sat Jul 14 04:32:44 CEST 2001

Interactively, I find myself writing little things like:

def pd(x):
        print x.__doc__
        print '(no doc string)'

so that, e.g., I can type


and get formatted info. But I'm lazy enough that
I would like to to type just
    pd vars

Is there an existing pythonic way to do this?

If not, would there be breakage if python were modified to make

    foo whatever-up-to-EOL

equivalent to


when it would be a syntax error otherwise? I.e., I'm wondering
if the grammar could be modified to do this by changing trailer
to accept arglist NEWLINE if _all_ else fails, and treat a match
as if it was an arglist. Leading '(' or '[' ambiguity would be
resolved in favor of normal arglist or subscriptlist.

More information about the Python-list mailing list