Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Python Testing Be Assertive Quantitative Assertions

Farrah Dickerson
Farrah Dickerson
10,173 Points

Why are we using Tabs within Workspaces? http://legacy.python.org/dev/peps/pep-0008/#tabs-or-spaces

:: From PEP 8 :: Tabs or Spaces? Spaces are the preferred indentation method.

Tabs should be used SOLELY to remain consistent with code that is ALREADY indented with tabs.

http://legacy.python.org/dev/peps/pep-0008/#tabs-or-spaces

:: Stack Overflow :: http://stackoverflow.com/questions/119562/tabs-versus-spaces-in-python-programming

:: Me :: It's a contentious issue, no doubt, but shouldn't beginners be learning the (literal) STANDARD?

2 Answers

Erika Suzuki
Erika Suzuki
20,299 Points

The workspace seems to be using spaces for tabs, last time I checked.

Set your editor to use spaces instead of a tab when you press the Tab key. Sublime Text 3, my favorite editor of choice does this, and it has a built in Python runner. I strongly recommend that editor. Also, to make sure you're not using tabs, set your editor to show invisible characters like indents (\t) and spaces (\s). If you're currently using tabs, you could convert them by find and replace using a regex pattern. find all "\t" and replace it all with " \s\s\s\s".

Seth Reece
Seth Reece
32,867 Points

If you set tabs to be in spaces with four spaces in workspaces, or your own text editor, hitting the tab key will make four spaces instead of a tab. Just a lot easier to hit the tab key instead the spacebar four times.