Python Grammar (was Re: A TYPICAL NEWBIE MISTAKE?)
Moshe Zadka
moshez at math.huji.ac.il
Mon May 15 00:12:19 EDT 2000
On Mon, 15 May 2000, Courageous wrote:
> I miss the colons all the time, too (as Mr. Pinard so
> readily pointed out.... ha). Which brings me to the topic.
> Sometimes colons seem syntactically unnecessary.
Theoretically, a colon is only necessary in things like
if yes: print "yes"
Since otherwise the parser can figure out when to stick a colon. However,
usability studies show people are more comfortable when the beginning of a
block is signaled, and I can see why:
if yes
print "yes"
Seems....naked. Much less readable then
if yes:
print "yes"
Guido didn't want 10 ways (or even 2) to spell things, so the colon is
mandated for all.
--
Moshe Zadka <moshez at math.huji.ac.il>
http://www.oreilly.com/news/prescod_0300.html
http://www.linux.org.il -- we put the penguin in .com
More information about the Python-list
mailing list