+ 1
Tabs or spaces?
So ignoring the fact that you should always use whatever is consistent with the code base that you're working in, what is your preference, tabs or spaces? Personally I use spaces because it is the recommendation in most of the languages I use which makes switching easier.
4 Respuestas
+ 2
yep, recommendations for indenting Python code is exactly 4 spaces.
but pressing tab 1 time is more convenient than pressing space 4 times.
for this most of text editors and IDE's provide functionality to replace tab with specified amount of spaces, so it solves convenience problem
+ 1
I always used spaces to avoid the way different editors handle the tab characters.
I like the Python 4 spaces also and try to do that everywhere i code.
That said, if you walk into a project that's already going and has a style guide that says you use tab then you use tab. Don't change style mid-stream to suit your personal preference.
+ 1
Tabs. They are easily selectable, removable, placable. The only advantage of whitespaces is that they look the same in all text editors.
0
spaces, as they are a fix measuring unit. when you work on a same code base with other developers, everyone has an idea how much indentation four spaces is. tabs can be replaced/ displayed differently, which is extremely dangerous in Python. have a research on "editorconfig" which makes group projects much easier!