Skip to content

Forbid assigning lambda to object properties #1733

@sobolevn

Description

@sobolevn

Rule request

Thesis

We should forbid code like:

class Example(object):
    def __init__(self):
        self.callback = lambda arg: arg + 1

Reasoning

This will be very tricky to understand for users: example.callback(1) will look like a method, but it is not a method.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions