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

Create a challenge for PEP 698 @override #56

Open
laike9m opened this issue Nov 28, 2023 · 1 comment
Open

Create a challenge for PEP 698 @override #56

laike9m opened this issue Nov 28, 2023 · 1 comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@laike9m
Copy link
Owner

laike9m commented Nov 28, 2023

PEP 698

@laike9m laike9m changed the title Create a challenge for [PEP 698](https://www.python.org/dev/peps/pep-0698/) @override Create a challenge for PEP 698 @override Nov 28, 2023
@laike9m laike9m added help wanted Extra attention is needed good first issue Good for newcomers labels Nov 28, 2023
@laike9m
Copy link
Owner Author

laike9m commented Dec 10, 2023

I find it hard to come up with a challenge for @override. We can have something like the following, but # expect-type-error always needs to resides with @override, and it's impossible to have @override in user code and # expect-type-error in test code.

"""
TODO:
Annotate the methods of class `Tiger`.
"""

class Animal:
    def eat(self, food):
        ...

from typing import override

class Tiger(Animal):
    @override
    def eat(self):  # expect-type-error
        ...

    @override
    def eat(self, food):
        ...

    @override
    def fly(self):  # expect-type-error
        ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant