Another newbie design question
Bruno Desthuilliers
bdesth.quelquechose at free.quelquepart.fr
Tue Dec 18 14:50:36 EST 2007
MartinRinehart at gmail.com a écrit :
> Fortran (1957) had line comments. C (1972) replaced these with non-
> nested block comments. C++ (1983) added here-to-EOL comments. Python
> (1991) keeps here-to-EOL comments but replaces block comments with
> multi-line quotes. Block comments and multi-line quotes both serve the
> same purpose as doc comments. Block comments, especially if they nest,
> are helpful for commenting out code. Multi-line quotes serve to add
> text.
>
> Is Python, in this particular, an advance over C++?
>
> I wrote a lot of Java (here-to-EOL and block comments) without ever
> feeling the need for multi-line quotes.
I wrote a lot of Java without ever feeling the need for things functions
as objects, lexical closures, lazy evaluation, anonymous functions etc.
Then I learned to use these features and couldn't stand coding in Java
no more.
> I've written a little Perl and
> found multi-line quotes useful for responding to -help switches. On
> the other hand -help switches are very old-fashioned, a direction I'll
> not be pointing my tiny beginner's language.
"old-fashioned" ? Do you have something better to suggest ? Please keep
in mind that most servers don't have GUIs (for obvious reasons).
But multiline strings are not only useful for "old-fashioned -help
switches" - they are useful anywhere you need a quick and simple text
templating system - be it html, javascript, SQL, whatever - and using a
full blown templating system would be overkill. IOW, like a lot of other
features, it's not that you cannot do without, but it really helps when
it's available *and* braindead easy to setup and use.
My 2 cents...
More information about the Python-list
mailing list