Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Without knowledge of JRuby, IronPython or Jython, I'm curious how Python's low tolerance for code formatting flexibility has helped here.

Anyone?



Python is intentionally simple to parse. The whitespace thing (if that's what you're referring to) goes like this: if a line is indented one more level than the previous line, that span of indentation becomes an <indent> token, applied for the rest of the indented block. So to figure out scope level for a given line, look at the number of leading <indent> tokens. That's it. Google knows more.


If I've said it once I've said it a thousand times: Python cares about indentation not whitespace. You can format your code any way you please, but it turns out that arguments about where to place curly braces don't actually contribute to getting real work done, and Python people don't miss them.


In perl you can write 'if(!bool) { ... }', 'unless(bool) { ... }', or even '... if(!bool)'

As I said, I'm not an expert in the languages in question, but the scope of code formatting flexibility is larger than just whitespace.


In Python you can do the same: 'if not bool: ...', 'while bool: ...', '[for ... if not bool]'. Crazy one-liners are also possible.

We have just enough formatting flexibility and we prefer readability.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: