Is there an easy way to control indents in Python

alex23 wuwei23 at gmail.com
Wed Oct 15 03:27:37 EDT 2014


On 15/10/2014 12:23 PM, Juan Christian wrote:
> Using PyCharm is easy:
>
> File > Settings > (IDE Settings) Editor > Smart Keys > Reformat on paste
>  > choose "Reformat Block"


This isn't as straight forward as you imply. Say I have misindented code 
like this:

     if True:
     print 'true'
     else:
     print 'false'
     print 'done'

If I select this block in PyCharm and reformat it, I get:

     if True:
         print 'true'
     else:
     print 'false'
     print 'done'

Which is still invalid. Even if it did work more fully, though, how 
would it determine the correct placement of the last line of code?



More information about the Python-list mailing list