Py3K idea: why not drop the colon?
Ron Adam
rrr at ronadam.com
Fri Nov 10 19:32:44 EST 2006
Michael Hobbs wrote:
> Ron Adam wrote:
>> It is also an outline form that frequently used in written languages. Something
>> python tries to do, is to be readable as if it were written in plain language
>> where it is practical to do so. So the colon/outline form makes a certain sense
>> in that case as well.
>>
> That is perhaps the most convincing argument that I've heard so far.
> Indeed, I often find myself writing out colons when writing pseudo-code
> out on paper. The reason, however, is usually because my indents don't
> quite line up as perfectly on paper as they do in an editor. The colons
> provide a form of backup separation for when my columns start to get
> sloppy. (Natural language is actually filled with such redundancies in
> order to compensate for sloppy handwriting.) This backup function
> obviously isn't needed when a computer is taking care of the layout.
>
> My final argument against the colons is to simply try programming in
> Ruby for a while and then come back to Python. I think you'll find that
> programming without the colons just simply feels more "natural".
LOL, of course it would. I would expect that too after a suitable amount of
'brain washing', oops, I mean training and conditioning. ;-)
The point is what is more natural to "read" with a minimum amount of
explanation. I would think for most people who are learning programming for the
first time, it is things that resemble things they already know. Such as
outlining with colons.
Leaving the colon out probably would feel more natural for writing once you get
used to it. After all it is a bit less typing. But I don't think it would be
the most readable choice for most people. It's probably a trade off,
readability vs writability. Another python development guideline is to favor
readability over writability on the presumption we tend to write code once, but
read code many times.
Here's an alternative test. Write a program to remove all the end of line
colons from pythons library and then write another separate program to put them
back in. Will it miss any? will it pass the python test suite?
I think you will find that that is more complex than it sounds. Try writing
colorizing routines for both versions? Which is easier?
Cheers,
Ron
PS. Rather than shav of on character her and ther in pythons programing
languag, Lets remov all the silent leters from the english languag. That will
sav thousands mor kestroks over a few yers.
I think if you try that for a few months and then switch back, you will find
writing without the silent letters just feels more natural. ;)
More information about the Python-list
mailing list