google / pasta

Library to refactor python code through AST manipulation.
Apache License 2.0
341 stars 40 forks source link

Support mixing tabs and spaces in python2 #70

Closed soupytwist closed 5 years ago

soupytwist commented 5 years ago

Yuck... but python2 recognizes a tab as 8 spaces when the two are mixed. Currently this produces an IndentationError when parsing.

Some good explanation here: https://stackoverflow.com/questions/2034517/pythons-interpretation-of-tabs-and-spaces-to-indent

There is probably a more graceful way to handle this situation, anyway, aside from failing outright.

lc0 commented 5 years ago

It's a quite a legacy combination of python2 and tabs and spaces mixed together. Definitely agree, that failing in more specific way would be better, might be even with advise to change tabs to whitespaces