4 ms·
Without knowledge of JRuby, IronPython or Jython, I'm curious how Python's low tolerance for code formatting flexibility has helped here. Anyone?
by j2d2 18y ago
Without knowledge of JRuby, IronPython or Jython, I'm curious how Python's low tolerance for code formatting flexibility has helped here.
Anyone?
- gaius 18y agoIf 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.
- j2d2 18y agoIn 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.
- ii 18y agoIn 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.
- etal 18y agoPython 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.