-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
A variable annotated with 'date' is not compatible with a value of type 'datetime'. #2487
Comments
The following program is rejected by mypy: from datetime import date, datetime
class Date: ...
class Datetime(Date): ...
now: date = datetime.now()
rightnow: Date = Datetime()
assert isinstance(now, date)
|
There's probably some incompatible methods. Try modifying the stub to make datetime inherit from date and run We could fix this by just |
mvaled
added a commit
to mvaled/typeshed
that referenced
this issue
Sep 26, 2018
mvaled
added a commit
to mvaled/typeshed
that referenced
this issue
Sep 26, 2018
@JelleZijlstra I created a PR in #2488 |
JelleZijlstra
pushed a commit
that referenced
this issue
Oct 2, 2018
yedpodtrzitko
pushed a commit
to yedpodtrzitko/typeshed
that referenced
this issue
Jan 23, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
datetime
is a subclass ofdate
. In the stubs of 'datetime' there's the following TODO:Is there any record of the incompatibilities? Should we keep an issue open to address this TODO eventually?
The text was updated successfully, but these errors were encountered: