Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

cls in classmethods of derived classes always refers to the parent class (rather than the derived one) #120

Closed
davidwallacejackson opened this issue Sep 21, 2018 · 2 comments · Fixed by #546
Assignees
Labels
bug Something isn't working

Comments

@davidwallacejackson
Copy link

Easier to explain with an example:

class Foo:
    @classmethod
    def get_an_instance(cls):
        return cls()

class Bar(Foo):
    pass

my_bar = Bar.get_an_instance()

In VSCode w/ Python plugin 2018.8.0, my_bar is typed as a Foo, while I'd expect it to be typed as a Bar.

@MikhailArkhipov MikhailArkhipov added the bug Something isn't working label Sep 26, 2018
@MikhailArkhipov
Copy link

Related #11

@MikhailArkhipov MikhailArkhipov self-assigned this Feb 6, 2019
@MikhailArkhipov
Copy link

image

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants