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
PEP 484 says "By default, None is an invalid value for any type". However, in the Python standard library there are class-level and module-level constants that are legitimately None.
The variables could be of their concrete type or of an optional concrete type depending on whether it is desirable to have the check for None enabled for them.
For example, a PEP 484 compatible definition of hmac.digest_size could look like this:
I was trying to avoid proposing that requires mypy changes, since it
looks like mypy treats the type `None` quite special. But sure, we'll
add that to the list of possibilities. @JukkaL, thoughts?
Activity
vlasovskikh commentedon Jun 26, 2015
The variables could be of their concrete type or of an optional concrete type depending on whether it is desirable to have the check for
Noneenabled for them.For example, a PEP 484 compatible definition of
hmac.digest_sizecould look like this:or like this:
gvanrossum commentedon Jan 26, 2016
Maybe one of the following should be declared best practice?
All of these work today with mypy.
matthiaskramm commentedon Jan 26, 2016
What about
It doesn't work in mypy yet, but mypy's error message sounds like it could, in the future.
gvanrossum commentedon Jan 27, 2016
Describe type vars with co/contra variance. Fixes python#2.
Merge pull request python#2 from python/master
gvanrossum commentedon Oct 27, 2016
This is almost(ish :-) over. With
--strict-optional, mypy does not complain aboutWe'll just have to finish for the strict None checking flag in mypy to become the default.
Add stubs for geohash (python#2)
Add stubs for geohash (python#2)
Add stubs for geohash (python#2)
add some missing constants
JelleZijlstra commentedon Apr 23, 2017
x = None # type: Noneworks fine in mypy with python/mypy#3024 merged.I'm submitting a PR to fix the specific objects @matthiaskramm mentioned.
add some missing constants (#1198)
Merge pull request python#2 from cocoatomo/transforms2
Change Tuple to tuple python#2
Address review #2
Address review comments python#2
Make changes to pass flake8 (python#2)
fix overrided init methods python#2