Black: minor: unnecessary newline inserted after `else` before function

Created on 23 Jun 2018  路  2Comments  路  Source: psf/black

current behaviour

(run against master)

$ black --diff test.py 2> /dev/null
--- test.py 2018-06-23 15:02:32.200993 +0000
+++ test.py 2018-06-23 15:03:00.152248 +0000
@@ -1,6 +1,7 @@
 if False:
     from x import y
 else:
+
     def y():
         pass

desired behaviour

(noop)

empty lines enhancement

Most helpful comment

This is deliberate. A def directly inside a def will do the same, too. This is to make inner defs more prominent.

We did relax this for first defs in a class so maybe we should generalize this for all indented blocks.

All 2 comments

This is deliberate. A def directly inside a def will do the same, too. This is to make inner defs more prominent.

We did relax this for first defs in a class so maybe we should generalize this for all indented blocks.

We will be solving this as part of #450.

Was this page helpful?
0 / 5 - 0 ratings