[prev in list] [next in list] [prev in thread] [next in thread]
List: python-mode
Subject: Re: [Python-mode] edit-style considering empty line
From: "Diez B. Roggisch" <deets () web ! de>
Date: 2013-09-24 6:45:23
Message-ID: 0F68651A-3AE2-4FF0-B925-84F7CD7B9641 () web ! de
[Download RAW message or body]
On Sep 23, 2013, at 9:57 PM, Andreas Röhler <andreas.roehler@online.de> wrote:
> Hi Barry, hi all,
>
> there was an expample at
>
> http://stackoverflow.com/questions/18940719/python-indentation-with-emacs/18940836#18940836
>
> if 1 < 2:
> print("this line is part of the if statement")
>
> print("this is NOT part of the if statement")
>
>
> The OP wanted the Editor intends the second "print" to column 0.
> IMO it's possibly establishing an edit rule saying: if an empty line follows a \
> block, consider this block closed.
> Now seeing the example below at
>
> http://pyvideo.org/video/1708/distributed-coordination-with-python
>
> def find(seq, target):
> for i, value in enumerate(seq):
> if value == tgt:
> break
> else:
> return -1
> return i
>
> If an empty line after "break" is inserted:
>
> def find(seq, target):
> for i, value in enumerate(seq):
> if value == tgt:
> break
>
> else:
> return -1
> return i
>
> That would allow to calulate the "else:" to column 4 right away.
> Also for me it's slightly better readable.
>
> Question: Would you welcome such an edit-style or rather discourage?
If it's optional, and initially off, I wouldn't mind. But vertical spaces are used to \
structure code for readability, and because of that shouldn't be automatically \
assumed having semantics.
Diez
_______________________________________________
Python-mode mailing list
Python-mode@python.org
https://mail.python.org/mailman/listinfo/python-mode
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic