Python's interpretation of tabs and spaces to indent

前端 未结 7 2051
孤街浪徒
孤街浪徒 2020-11-30 08:43

I decided, that I learn a bit of Python. The first introduction says that it uses indentation to group statements. While the best habit is clearly to use just one of these w

7条回答
  •  粉色の甜心
    2020-11-30 09:04

    I believe that the tab character should simply never appear in source code under any circumstances. There's no advantage to it and it's an endless source of tiny errors. - use a character string with \t if you need a tab, it has the advantage that it's self-documenting.

    Here's the classic article about tabs vs spaces - I use a variant of jwz's elisp in my own .emacs file.

    (I confess to personally breaking with PEP 8 by using only 2 characters' indentation - 4 characters is a lot when your lines are only 80 characters...)

提交回复
热议问题