Adding print-style function calls, and preproc plugins

Delaney, Timothy tdelaney at avaya.com
Thu Aug 30 20:42:57 EDT 2001


> From: Gerson.Kurz at t-online.de [mailto:Gerson.Kurz at t-online.de]
> > From: Steven D. Majewski [mailto:sdm7g at Virginia.EDU]
> > What does:
> > 	"e1 e2 e3 e4 e5"
> > mean when more than one of those e's is a function ?
> > Can you tell which ones represent function calls if you don't
> > know the value of all of the e's ?
> 
> Well please remember what my original intent was: writing my own print
> function - er - statement. So, is "print e2 e3 e4 e5" a valid 
> statement ?
> No. Is "print e2,e3,e4,e5" ambiguous ? No. So what is the problem?
> 
> I was quite astonished about how strongly people seemed to 
> react to that
> idea. 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.

Well, add one more person to your list. I abhor unadorned function calls -
or at least when both syntaxes are supported.

However, I'll get away from my personal feelings (print should never have
been a statement, even though I use it myself - it's only for throw-away and
debugging work).

The most important thing here is backwards compatibility. And new syntax
*must* be backwards-compatible with existing syntax. Thus the existing way
of calling functions f(arg1, arg2, ...) must be preserved.

Now we add in the ability to call a function without parentheses.

a = f(1, 2) # Is this f called with two arguments, or a tuple of length 2?
a = f       # Is this a function call, or a rebinding of a to a callable
object?

These two things are impossible to disambiguate, and as such the feature can
never become part of the language.

Letting my personal feelings back, I say thank you Guido for making this
impossible!

Tim Delaney




More information about the Python-list mailing list