Re:Python best practices
by attack on Tuesday July 08, 2008 @08:59PM
(#240596)
And look how complicated they make it. Sometimes spaces, sometimes not, how confusing. And tell me that their "Use spaces around arithmetic operators" example doesn't make you want to puke:
Who writes like that?? I very strongly disagree.
[ Parent
| on HN ]
"Who writes like that??"
The authors of:
BitTorrent: https://develop.participatoryculture.org/trac/democracy/brow...
Django: http://code.djangoproject.com/browser/django/trunk/django/ut...
Pylons: http://pylonshq.com/project/pylonshq/browser/pylons/util.py
Twisted: http://twistedmatrix.com/trac/browser/trunk/twisted/python/u...
I do. I think it looks a lot better and more clear. It certainly looks a lot like what I would write down on paper, and that is one of the inherent qualities of Python in general.
The one place that I don't follow the guideline (unless it's the guideline and I just don't know it... it rarely comes up, so I haven't bothered to check) is on array indices. I do write:
a[i+1]
Re:Python best practices
by albertcardona on Wednesday July 09, 2008 @12:16PM
(#241312)
Same here. I conceptualize it as part of a code compactness strategy: array indices are part of the same item, and thus I use syntax (like yours) that suggests inlining.
Same here, for the same reason.
I do. I find that code with the spaces around assignment and arithmetic operators is way easier to read.