Naked function call syntax

Steve Holden sholden at holdenweb.com
Mon Jul 16 08:40:51 EDT 2001


"Bengt Richter" <bokr at accessone.com> wrote in message
news:3b4fa037.1845423078 at wa.news.verio.net...
> Interactively, I find myself writing little things like:
>
> def pd(x):
>     try:
>         print x.__doc__
>     except:
>         print '(no doc string)'
>
> so that, e.g., I can type
>
>     pd(vars)
>
> 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
>
>     foo(whatever-up-to-EOL)
>
> 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.
>
Python is not Perl. Nor should it try to be. Not even to increase typing
convenience!

regards
 Steve
--
http://www.holdenweb.com/








More information about the Python-list mailing list