Is there a way around coding in Python without the tab, indent & whitespace criteria?

前端 未结 29 981
小鲜肉
小鲜肉 2020-12-31 14:05

I want to start using Python for small projects but the fact that a misplaced tab or indent can throw a compile error is really getting on my nerves. Is there some type of s

29条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-31 14:45

    Nope, there's no way around it, and it's by design:

    >>> from __future__ import braces
      File "", line 1
    SyntaxError: not a chance
    

    Most Python programmers simply don't use tabs, but use spaces to indent instead, that way there's no editor-to-editor inconsistency.

提交回复
热议问题