Forum Archive

Tip: Mixing Spaces with Tabs

achorrath233

I'm used to using spaces in my python code, and I'm not used to having a tab key in iOS, so I spent some time struggling with "Indent doesn't match" type errors.

Then I remembered that modern python does have some support for mixing spaces with tabs. I did some digging and found that you can set the tab width in a comment at the top of your code:

tab-width: 2

I now use this at the top of all my scripts and I no longer see indentation complaints when running them.

omz

Very interesting! I wasn't aware of this.