Tab vs. Space | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Tab vs. Space

Is it better (cleaner, efficient, faster etc.) to tab indentations or use spacebar. Discuss.

10th Jul 2016, 10:16 PM
D M
6 Answers
+ 3
Well, according to the Python's philosophy: Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. Complex is better than complicated. Readability counts. It's up to you... however if you want a clean, beautiful and readable code you should tab indentations; its let you read easily the code, identity the blocks.
10th Jul 2016, 10:30 PM
Francisco Gómez García
Francisco Gómez García - avatar
+ 3
The python style guide (PEP 8) recommends spaces. I always use 4 spaces.
11th Jul 2016, 5:04 AM
Tyrel Mitchell
Tyrel Mitchell - avatar
+ 1
I personally prefer tab, but many people like 2-3 spaces. It's up to personal preference.
10th Jul 2016, 11:28 PM
Yarden Akin
Yarden Akin - avatar
+ 1
tabs can be displayed differently in different editors while spaces are constant. apart from that,i dont think there is much difference.
11th Jul 2016, 1:39 PM
RedAnt
RedAnt - avatar
+ 1
tab or 4 spaces either one is recommended
11th Jul 2016, 4:05 PM
Nitin Lakhwani
Nitin Lakhwani - avatar
+ 1
using tabs may cause problems when changing editors,or pasting ur code to a page,or sending it to some1 else to edit.but I prefer tabs to spaces for speed.quick fix for the errors is that most editors have an option to convert tabs to 4 spaces.fixes compatibility issues between different editors
12th Jul 2016, 12:39 AM
vicken bedikian
vicken bedikian - avatar