A Suggestion for Python Colon Syntax

Tim Peters tim.one at home.com
Fri Dec 22 23:15:16 EST 2000


[Vadim Zeitlin]
> Isn't it desirable (although not necessary) to attract more
> people to Python?

I think so, yes.

> IMveryHO any simplification of the syntax without any bad
> consequences (are there any in this case?) would be welcome from
> this point of view.

Oh, let's get real here:  the only syntax change that could possibly attract
a significant number of newcomers would be to add curly braces.  That's
because that's the only syntax change left that has a significant
constituency (the "optional trailing colon" thing comes up maybe two times
per year, and Bill is the first person to bother bringing it up twice
<wink>).

> BTW, what was the real rationale for adding composed assignment
> operators (+=) to Python 2.0 (which I'm really extremely glad to
> have now)?

1. According to Guido, it was the single most-requested feature in the
history of the language, and he never disapproved of it.  It took several
years for "the right way" to implement it to become apparent, else it would
have gone in much earlier.

2. The NumPy people had a real problem in that

    x = x + y

could end up generating multimegabyte temp arrays while

    x += y

need not.  That is, for them it wasn't "just another way" to write the
former; it offers crucially different semantics.

> Wasn't it meant to make Python more attractive to the people
> coming from C-lie languages?

And here I thought it was to make Python more attractive to Icon programmers
<wink>.

> And, if by chance it was so, why not continue making
> it even more simple to use to the very same people?

curly-braces-ly y'rs  - tim





More information about the Python-list mailing list