3 ms·
Please use 2 or 4 spaces while writing python code. It becomes impossible to read.
by bbayer 13y ago
Please use 2 or 4 spaces while writing python code. It becomes impossible to read.
- nilliams 13y agoI agree with you for code samples in READMEs, but for actual code allow people to respectfully disagree [1]. The benefit of tabs is that you can open it in your editor and set you editor to view tabs at whatever your spacing preference (2 or 4 spaces). That github doesn't let you specify the tab-sizing you wish to view the code at is no fault of the author's (it would be a nice feature for github to add). Please don't throw PEP8 at me :) [1] http://lea.verou.me/2012/01/why-tabs-are-clearly-superior/ http://lea.verou.me/2012/01/why-tabs-are-clearly-superior/
- smnrchrds 13y agoWhy not? It's a convention almost everyone has agreed upon. More than 95% of python code out there uses spaces[1]. The new PEP-8 prefers spaces over tabs. I have configured my text editor to put 4 spaces when I press the tab key and auto-indent with 4 spaces as well. Now, if I want to contribute to a project which uses tabs instead of spaces or use such a project in my own code, I have to change my text editor preferences every time I open those files or fork the project and convert tabs to spaces. Tabs may have some advantages over spaces, but uniformity is far more important. [1] http://sideeffect.kr/popularconvention/#python http://sideeffect.kr/popularconvention/#python
- free652 13y agoSpaces look uniformed everywhere. Configuring every tool to use tabs with the right size is just crazy: * SVN diff tools * Web SVN webbrowsers * Vi * Eclipse * Chrome