You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For task 110 I had to rename the last variable from user to new_user as I'd previously received an error stating that we can't assign a type to a variable which already has a type. Would just like to check if there's an alternative solution which doesn't involve renaming the variable.
I guess the indentation is causing the issue(in the original file). The mypy is in strict mode which uses user as variable User and the line new_user: Optional[User] = User.get_user(name="Guido") use variable as Optional[User]. This causes the mypy to raise error.
There is no issue with the your code, can you align the code like this and try?
def main() -> None:
. ..
# Same level as main
user: Optional[User] = User.get_user(name="Guido")
For task 110 I had to rename the last variable from
user
tonew_user
as I'd previously received an error stating that we can't assign a type to a variable which already has a type. Would just like to check if there's an alternative solution which doesn't involve renaming the variable.Here's the relevant line: https://github.com/J0/python-typing-koans/blob/main/koans/py/110-easy-class-variable.py#L66
The text was updated successfully, but these errors were encountered: