Skip to content

Add error on imports inside class definitions #351

Open
@IanLee1521

Description

@IanLee1521

Opening a new issue for this based on discussion from @ncoghlan on issue #304 .

Flagging module level imports that don't occur at the start of the file and imports inside class definitions as errors seem like reasonable additions to me. The latter is technically going beyond the text of the PEP itself, but I'd be incredibly surprised if anyone complained about you flagging it as an error - while imports at class scope are permitted by the language, deliberately adding a module as a class attribute would just be weird.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions