Is there an easy way to control indents in Python
Ian Kelly
ian.g.kelly at gmail.com
Wed Oct 15 15:30:17 EDT 2014
On Wed, Oct 15, 2014 at 11:12 AM, Terry Reedy <tjreedy at udel.edu> wrote:
> On 10/15/2014 10:32 AM, Chris “Kwpolska” Warrick wrote:
>> 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.
I agree. I very rarely use blank lines inside functions. As I see it,
if you feel you need a blank line for separation within a function,
that's an indication your function is overly complex and should be
broken up.
Keeping blank lines out of functions also makes it easy to copy/paste
those functions into the interactive interpreter, which can be handy
e.g. when sharing snippets of code by email.
More information about the Python-list
mailing list