-
Notifications
You must be signed in to change notification settings - Fork 256
TypedMapping
for extended compatibility?
#1952
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
Comments
I found a few references mentioning this, most notably PEP 705 and a few related posts on the python forum:
One of the mentioned issue was the lack of "strong use-case", which is a bit hard to discuss in complete objectivity and time-consistency. I personally find the use case I described in opening quite standard. A point I'd like to make is that many discuss |
Yeah that was how I thought about it originally. I would have liked it to type data frames and other mapping like things. |
With class DoubleThink(int, Enum):
FIVE = 2 + 2 So how about using this same trick to avoid having to introduce a new class Movie(Mapping[str, str | int], TypedDict):
author: str
year: int I'm not sure if this has been proposed before, but I thought I might as well throw it out there. |
I'm not entirely sure, but I think your approach forces inheritance from |
Hello,
Consider the following, where
lock
aims at making provided argument immutable.It works great with
mypy
, no issue. Now imagine I want to enforce a bit more tofoo
by requesting it be compatible with aMovie
. I would try the following, without success.Is there an workaround? If not, is if a good idea to discuss the possibility of a
TypedMapping
, that would simply work as follow?Thanks for your time.
All the best!
Élie.
The text was updated successfully, but these errors were encountered: