Skip to content

What about comments before functions? #56

@funkyfuture

Description

@funkyfuture

i don't know whether black handles this phenomenon purposely this way. i usually put annotations regarding a specific function in general right before it's definition:

# foobar functions


def bar() -> None:
    pass

# TODO add type annotations
def foo():
    pass

black adds two lines between the annotation and a specific function which looks like general, rather module oriented comments or 'section headings' i usually use as well:

# foobar functions


def bar() -> None:
    pass


# TODO add type annotations


def foo():
    pass

are there rationales i'm not aware of that lead to this transformation or could this behaviour get changed?

edit: interestingly the snippets in the README also contain such style.

Metadata

Metadata

Assignees

No one assigned

    Labels

    F: commentsThe syntactic kind. Not in the language grammar, always on our minds. Best bugs.T: styleWhat do we want Blackened code to look like?

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions