[wellylug] Non-standard languages on Linux
Phillip Hutchings
sitharus at gmail.com
Tue May 10 11:41:18 NZST 2005
On 10/05/05, David Antliff <dave.antliff at paradise.net.nz> wrote:
>
> On Tue, 10 May 2005, Phillip Hutchings wrote:
> > Python is great. Indentation replaces curly brackets
>
> Python looks good, but what the heck was with the decision to use
> indentation to delimit code blocks? A real shame. Can someone tell me why
> it's better than using symbols?
Note: I've basically done transliterations of the C code into python
and ruby - don't try to run them.
c99:
int main(int argc, char[] *argv)
{
for (int x = 0; x < 5; x++)
{
x++;
printf("%i", x);
}
return 0;
}
python:
def main(argc, argv):
for x in range(4):
x++
print "%i" % x
Ruby (for completeness):
def main(argc, argv)
4.times do |i|
puts i.to_s
end
end
This is how I write code, I always indent, and I always use 4 spaces,
not tabs, but that's another discussion. Why should I bother with
delimiting with extra text? It's just a waste of characters for
something that I'm already enforcing.
Of course, if you have a stubborn person on your team who wants to use
their personal indentation style, then extra delimiters are really
useful.
Ruby uses end to delimit. In this case Python is the shortest in terms of lines.
--
Phillip Hutchings
http://www.sitharus.com/
sitharus at gmail.com / sitharus at sitharus.com
More information about the wellylug
mailing list