On 10/15/2014 10:32 AM, Chris “Kwpolska” Warrick wrote:
On Wed, Oct 15, 2014 at 9:27 AM, alex23 <wuwe...@gmail.com> wrote:
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?
--
https://mail.python.org/mailman/listinfo/python-list
It should parse this as
else:
print 'false'
print 'done'
Why? Because things like `print 'done'` usually have an empty line before it:
There is no such rule in Python so it hardly dependable for auto indenting.
if True:
print 'true'
else:
print 'false'
print 'done'
That should be parsed the way you want it done. Makes perfect sense
when you look at it.
--
Terry Jan Reedy
--
https://mail.python.org/mailman/listinfo/python-list