On Sat, Dec 6, 2014 at 4:40 AM, Aahan Krish <kr...@aahan.me> wrote: > I have two general questions regarding Python that I couldn't find any good > answers for. This is not the often-asked Tabs vs Spaces question, so kindly > read it in whole. > > Q1. This is not to debate the decision, but I really wanted to know the > reason why PEP 8 chose to go with spaces instead of tabs. I read that tabs > were initially preferred over spaces (esp. Mr. Rossum)? What caused the > decision that spaces are better?
The decisions in PEP 8 govern the Python standard library *only*. For any other project, you're free to say "We'll follow PEP 8 but using tabs for indentation" or "We'll follow PEP 8 but use three spaces for indentation". (Yes, you're free to be utterly insane.) Personally, I prefer and recommend tabs for indentation. That way, if there's any argument about how wide indents ought to be, the belligerents can simply reconfigure them. But ultimately, there's very little difference between "use tabs" and "use four spaces" and "use eight spaces" and "use two spaces" (though I'd put them in that order); the most important thing is to choose *something* and stick with it. Oh, and get yourself an editor that tells you when you've mucked them up. SciTE does; a little blue line fills the indent if it's wrong compared to the previous one. I work with a lot of students who use Sublime, have it set to show tabs as four spaces wide, and then have no idea why their code isn't working. Hmm. I guess "alias python='python -tt'" would be a good thing, here. ChrisA -- https://mail.python.org/mailman/listinfo/python-list