Hi all,
Recently while writing some Python ane Perl code, I noticed that the features provided by the language are useful in dual roles. Perl is anyway famous for TIMTOWTDI.
Consider comments - multiline comments.
There is no dedicated multiline comment character-sequence in Perl/Python, but the common(and probably official way) is
In Perl:
Use the perl module documentation(pod) lines
E.g.
=head
... some code ...
=cut
In Python:
Use the triple-quote string
E.g.
"""
... code...
"""
Even though C/C++ provides the /* ... */ sequence, they cannot nest, so generally the
preprocessor is used to get rid of huge lines of code with
#if 0
...code...
#endif
Interesting....
[update-2/6/10]
After a short sprint with Lua, I found even Lua has a multiline string ([[ ... ]]) , similar to the triple-quote strings of Python, which can be turned into a comment with a leading --:
--[[
A multi
line
comment
]]
[update: 21-May-2015]
In bash, the null command can be used for multi-line comments!
: ' some
long boring
stuff
'
--
Ani
Recently while writing some Python ane Perl code, I noticed that the features provided by the language are useful in dual roles. Perl is anyway famous for TIMTOWTDI.
Consider comments - multiline comments.
There is no dedicated multiline comment character-sequence in Perl/Python, but the common(and probably official way) is
In Perl:
Use the perl module documentation(pod) lines
E.g.
=head
... some code ...
=cut
In Python:
Use the triple-quote string
E.g.
"""
... code...
"""
Even though C/C++ provides the /* ... */ sequence, they cannot nest, so generally the
preprocessor is used to get rid of huge lines of code with
#if 0
...code...
#endif
Interesting....
[update-2/6/10]
After a short sprint with Lua, I found even Lua has a multiline string ([[ ... ]]) , similar to the triple-quote strings of Python, which can be turned into a comment with a leading --:
--[[
A multi
line
comment
]]
[update: 21-May-2015]
In bash, the null command can be used for multi-line comments!
: ' some
long boring
stuff
'
--
Ani
No comments:
Post a Comment