Builtin function versus new syntax for PEP308 -- was Re: PEP308: Yet another syntax proposal

Andrew Dalke adalke at mindspring.com
Tue Feb 11 20:31:46 EST 2003


Gareth McCaughan:
> The arguments against (any given version of) the proposal are
>   1 It enlarges the language and therefore makes it harder to learn.
  ..
> #1: ease of learning.
>
> Learning about a new function takes time, just as learning about
> a new bit of syntax does. Does anyone have any evidence that
> "ifelse(C,x,y)" would be easier to master than "if C: x else: y"?

Evidence?  No.  However, languages are designed (nearly always)
with the ability to get new functions without changing the syntax
of the language.  On the other hand, few languages are designed
so the syntax can be changed.

As such, as new function is part of the existing language,
while new syntax is part of a new language which just happens
to be close to the old one.

> Adding a new builtin function makes Python more
> complicated just as much as adding a new bit of syntax does.

No, it does not.  For example, if you want to find out
what the "ifelse" function does, you can do

>>> help(ifelse)

or use the corresponding help facilities of your IDE
of choice.

In general, you cannot do so with syntax.  "help([)"
does not work.

> #2: possibility of abuse.
>
> Well, of course, *anything* can be abused; we all know that.
> The question is: given any particular level of malignity or
> thoughtlessness, how horrible is the resulting abuse likely
> to be? :-)

According to my estimates, based on the analysis of existing
C/C++ code and of existing Python code, I believe the
misuse rate will be about 1 misuse for every 3 proper uses.

(Actually, I think that's the low end and the misuse rate
will be higher, but I'm willing to live with it for the point
of dicussion.)

                    Andrew
                    dalke at dalkescientific.com






More information about the Python-list mailing list