ibneko: (Default)
[personal profile] ibneko
Here's something about python that's a problem-

Since syntax / indenting indicates loops, there's irreversible loss of information. Take, for example:

marked = [0] * 1000000
value = 3
s = 2
while value < 1000000:
if marked[value] == 0:
s += value
i = value
while i < 1000000:
marked = 1
i += value
value += 2
print s

as someone posted as an answer to problem 10 of Project Euler. (Frankly, for that problem, I was lazy and just pulled a list of primes). But... without curly brackets used in other languages, the meaning of the code is completely lost.

Ruby, the other language I intend to pick up this break, looks like it's the same, but at least it uses "end"s, so I can quickly repair the syntax using regex. But python... :-\

Went searching on google for similar arguments: here's the best I've noted so far: http://www.parand.com/say/index.php/2006/12/11/on-python-ruby-and-whitespace/

In short, it boils down to:
Readability/uniform standards across the board (Python) ==VS.== No Data Loss with whitespace loss(Perl, C, Java)

Frankly, I would much rather sacrifice readability to losing data. Yes, there's ways to carefully post code online to ensure that your whitespaces don't get eaten by html/forum systems/databases, but that's more of a hassle*. And other languages could be written so it's readable too. Frankly, I rarely have an issue going back and re-reading my year-old perl code. And well-formatted code online is never difficult to read.

*and your easy options, such as PRE aren't always supported, so you'd have to manually go and do a s\ \&nbsp;\g replacement.

Expand Cut Tags

No cut tags

Profile

ibneko: (Default)
ibneko

Most Popular Tags

Style Credit

Page generated Jan. 21st, 2026 02:37 am
Powered by Dreamwidth Studios
January 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 2021