Skip to content

Support bound methods in stubs #761

@hauntsaninja

Description

@hauntsaninja

For instance,

class WorkingSet:
    def require(self, *requirements: _NestedStr) -> Sequence[Distribution]: ...

working_set: WorkingSet
require = working_set.require

This is something mypy supports and has come up a couple times in typeshed, since it reduces redundancy / allows changes to be made in only one place. e.g. python/typeshed#4817, https://github.com/python/typeshed/blob/ac234f25927634e06d9c96df98d72d54dd80dfc4/stdlib/2and3/turtle.pyi#L284-L291 and python/typeshed#4282 (comment)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions