-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Done #815
base: master
Are you sure you want to change the base?
Done #815
Conversation
app/main.py
Outdated
# "I'm not sure if this is the best solution" | ||
# " for creating accurate type annotations, " | ||
# "but the others are not working for me." | ||
|
||
T = TypeVar("T", bound="Distance") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not a good idea. You can use Distance
for type annotation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Place from __future__ import annotations
on the first line, it should resolve the issue. In case not, make sure that you have Python 3.11 installed and bound to the IDE to utilize the latest functionality. You should use the plain Distance
in the type annotation. If all steps described above are not successful, visit one of the Q&A sessions to resolve the issue.
app/main.py
Outdated
if isinstance(other, Distance): | ||
self.km += other.km | ||
return self | ||
if isinstance(other, (int, float)): | ||
self.km += other | ||
return self |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
write it with one return
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Several changes were requested.
app/main.py
Outdated
# "I'm not sure if this is the best solution" | ||
# " for creating accurate type annotations, " | ||
# "but the others are not working for me." | ||
|
||
T = TypeVar("T", bound="Distance") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Place from __future__ import annotations
on the first line, it should resolve the issue. In case not, make sure that you have Python 3.11 installed and bound to the IDE to utilize the latest functionality. You should use the plain Distance
in the type annotation. If all steps described above are not successful, visit one of the Q&A sessions to resolve the issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job!
No description provided.