Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

__lt__ missing for NamedTuple #1098

Closed
ytimenkov opened this issue Oct 13, 2020 · 2 comments
Closed

__lt__ missing for NamedTuple #1098

ytimenkov opened this issue Oct 13, 2020 · 2 comments
Labels
addressed in next version Issue is fixed and will appear in next published version bug Something isn't working

Comments

@ytimenkov
Copy link

Describe the bug
This code issues a warning: "__lt__" is not definedPylance (reportUndefinedVariable)

class TimerItem(NamedTuple):
    deadline: float
    callback: Callable

    def __lt__(self, rhs: "TimerItem") -> bool:
        return self.deadline < rhs.deadline

Adding another method like __repr__ doesn't issue a warning

Sounds similar to recently fixed methods for dataclass...

I have Pylance VS Code extension v2020.10.0

@erictraut
Copy link
Collaborator

Thanks for the bug report.

I've confirmed that this is related to the semantic highlighting feature in pylance. It appears to have been fixed already. I'm able to repro it with last week's pylance release, but it no longer repros with the latest code.

@erictraut erictraut added addressed in next version Issue is fixed and will appear in next published version bug Something isn't working labels Oct 13, 2020
@erictraut
Copy link
Collaborator

This is addressed in Pyright 1.1.79, which I just published. It will be in the next release of pylance as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addressed in next version Issue is fixed and will appear in next published version bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants