3 ms·
I try very hard to follow PEP 8, but I have noticed some very nice python code(such as the setup portion of Peter Norvig's beautiful sudoku code http://norvig.c
by eieio 14y ago
I try very hard to follow PEP 8, but I have noticed some very nice python code(such as the setup portion of Peter Norvig's beautiful sudoku code http://norvig.com/sudoku.html http://norvig.com/sudoku.html) that alligns equals signs using more than one space. I try to use allignment when it makes the code easier to read, but if I'm unsure I will defer to PEP 8 and not allign.
- zalew 14y agoif you care enough make a tutorial, you should care enough promote best practices, just sayin'. I ignored pep8 for a long time, until I noticed more and more whitespace mess in diffs. Following pep just makes work easier.
- famousactress 14y agoSaying "best practices" makes my brain turn off. Call it 'dogma', it's more accurate because it lacks the subjective boolean people like to slip behind 'practices'. I get it. PEP-8 is rad, and pretty well accepted... but: 1. It's a blog post. It's subjective opinion. 2. Whitespace alignment is rad, and some of the PEP-8 whitespace rules are pretty unfortunate. I guess if it were me I'd at least have called out that the alignment violates PEP-8 as a warning to folks.. and I wouldn't have led the tutorial with it, so that I'd at least be dealing with trolls that make it through the entire post.
- eieio 14y agoI did find it strange that the post didn't even address that the allignment advice was contrary to PEP 8. That being said, I definintely find my_data = 3 your_data = 2 much easier to skim than my_data = 3 your_data = 2 Given that PEP 8 even says "But most importantly: know when to be inconsistent -- sometimes the style guide just doesn't apply. When in doubt, use your best judgment. Look at other examples and decide what looks best." I have no problem occasionally using more than one space for allignment.