Hacker News new | past | comments | ask | show | jobs | submit login

> The one pitfall for block indenting in Python is reading online documentation. The block indenting gets screwed up sometimes.

Sometimes, pressing "view source" in the browser and looking at the HTML will reveal what it was supposed to look like.




Mind, this is not unique to Python. It's a bit more irritating in Python because indentation is significant, but I've seen a lot of unindented samples of other languages with correspondingly reduced readability. For some reason, I've most seen such sloppiness in presenting Javascript code.


Yes, but the reduced readability is an easy fix in that case. You can copy the code into an editor and indent based on the braces or have your editor auto-format the code. Badly formatting code in other languages does not change the meaning of the code as it does in Python.


I'm not sure what your point is, as I already acknowledged that in the comment you're responding to, while making it clear that my concern was readability of code examples on a web page. Are you going for a cheap "gotcha"?


My point is poor readability of samples in other languages is a really simple fix. I have cut'n'pasted many code samples into editors just to re-intent them for reading. With Python, sadly, it's just not possible to that roboticly.


I do not think the author was not aware of this, it was more of him digressing.


I think that being able to fit the whole source on a single page more than compensates for the occasional indentation problem.




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

Search: