0

Is the code inside an if/else statement indented with tab or space?

23rd Oct 2016, 10:23 AM
Savannah Eastler
Savannah Eastler - avatar
6 Respostas
+ 1
Either, but 'spaces' preferred (from Python's style guides): https://www.python.org/dev/peps/pep-0008/#tabs-or-spaces Highlights differences between 3.x and 2.x and basically recommends readable (not foolish) consistency...if you back up and read a section above: https://www.python.org/dev/peps/pep-0008/#id15
23rd Oct 2016, 6:00 PM
Kirk Schafer
Kirk Schafer - avatar
+ 1
A tab is recognized differently than spaces. Using a text editor or IDE, you are able to assign the tab button to a certain number of spaces (good practice says to use 4). so while you are pressing tab, your editor is actually using a number of spaces instead. :)
26th Oct 2016, 12:25 PM
Alex Schrichte
Alex Schrichte - avatar
0
you can use tab or a number of spaces. But in whole block inside the same
23rd Oct 2016, 3:26 PM
Petr Hatina
Petr Hatina - avatar
0
4 spaces for indentation is suggested for Python
23rd Oct 2016, 3:59 PM
Nevzat Akkaya
Nevzat Akkaya - avatar
0
when ever u want indentation tin program use tab key.
27th Oct 2016, 3:59 PM
Sonup Sharma
Sonup Sharma - avatar
0
Best Solution for this is you just use Sublime text editor this was awesome editor for Python There is option like Tab Indentation or Space Indentation Just select it.
29th Oct 2016, 4:27 AM
Ugra Narasimha
Ugra Narasimha - avatar