[Python-ideas] Making colons optional?

Bruce Leban bruce at leapyear.org
Sun Feb 8 08:20:55 CET 2009

On Sat, Feb 7, 2009 at 10:47 PM, Riobard Zhan <yaogzhan at gmail.com> wrote:

> On 6-Feb-09, at 2:27 PM, Bruce Leban wrote:
>> So what? Commas are also mandatory. They look like semicolons so we should
>> make them optional too. Am I joking?
> You can not generalize that far. Most programming languages require commas
> (notable exceptions include Lisp and Tcl), but Python is the only language
> that requires trailing colons.

Nope. See http://en.wikipedia.org/wiki/Smalltalk

Sure Lisp doesn't use commas. Parenthesis can be made optional in Lisp too.
Therefore semicolons, colons, commas and parenthesis are all equally
optional. Woohoo! No pesky syntax!

There are some differences between making commas optional and making
> trailing colons optional.

"There are some differences between making X optional and making Y optional"
for all features X and Y.

Clearly the use of the specific semicolon character is confusing you. So
let's replace it with a better symbol: \n as in this example:

  for i in x: foo(i) \n bar(i+1)

Sure a \n is optional at the end of any line because a blank line is always
allowed. So what?

--- Bruce
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20090207/4fd2c78e/attachment.html>

More information about the Python-ideas mailing list