Adding print-style function calls, and preproc plugins

Gerson Kurz gerson.kurz at
Thu Aug 30 18:50:14 CEST 2001

On Thu, 30 Aug 2001 16:40:14 +1000, Richard Jones
<richard at> wrote:

>So, what's the call:
>   def foo():
>      return 1
>   a = foo
>Does that assign a to the function object, as it does at the moment, or does 
>it assign a to 1?

Alex Martelli wrote:

> And of course there's no problem interpreting whether:
>    blobber plikke
>    blobber(plikke)
>    blobber(plikke())

Well please remember what my original intent was: writing my own print
function - er - statement. So, is "print = foo" a valid statement? No.
Is "print plikke" ambiguous? No. Is "print plikke()" ambiguous? No. So
what is the problem? Just add the tiny little restriction that there
is only one statement-like-function-call-per-instruction (separating
by ; should work naturally) and you have a (IMHO neat) syntax trick.

Maybe you're too much reminded of the way this works in Perl & VB.
But please, my problem was that I had to modify print's behaviour, and
couldn't do so, because by going from "print" to a function, you have
to enclose the arguments in brackets.

More information about the Python-list mailing list