Comments (2)
I don't think that mypy currently supports the type guard pattern None in <tuple literal>
. This should probably be considered a feature request rather than a bug report.
a: None | float = 0.0
b: None | float = 0.0
if None in (a, b):
reveal_type(a) # None | float
reveal_type(b) # None | float
from mypy.
Ok sorry 😅 Didn't think about testing it that way.
Can be changed to a feature request 👍
from mypy.
Related Issues (20)
- false "Attempted to reuse member name in Enum definition"
- segfault with Protocol.__call__(self: Self, ...) HOT 1
- `mutable-override` not in docs header correctly
- `mutable-override`: does it exist? HOT 1
- "lax_numpy.float64" is not a valid type in python3.8
- Request: opt-in rule preventing duplicate error codes
- mypyc/lib-rt/setup.py: distutils deprecated in python 3.12 HOT 2
- (🐞) Modules don't really conform to `Protocol`s do they HOT 3
- (🎁) narrow falsey string to `Literal[""]`
- Mypy failing to understand `ProgressBar` and `contextlib.nullcontext()` are both context managers HOT 1
- Need type annotation on context_manager variable HOT 1
- MyPy doesn't understand types-boto 2.49.18.20240205 correctly and fails previously-working code
- IndexError in property incompatible with supertype HOT 2
- `next(iter(<Tuple[...]>))` should be a `Union` of the `Tuple` element types, rather than their most descended common ancestor
- `try from typing import ParamSpec except from typing_ext import ParamSpec` not working HOT 4
- (🐞) Incorrect analysis of `while` loop subject
- Maybe add semantical understanding of `assert not TYPE_CHECKING` (similar to `if not TYPE_CHECKING`)?
- Cannot use `match case` to destructure any object using `case object(x=y)` HOT 4
- Way to disable missing library stubs errors HOT 1
- (🐞) `Protocol`s that narrow to modules become `Any`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mypy.