- Notifications
You must be signed in to change notification settings - Fork263
-
I think it's a relatively common pattern to have some kind of object that represents a value at a later date, or some other kind of "wrapping" type, such as a Twisted Concretely: https://github.com/cjw296/generative_typing/blob/main/bag.py ...which can be used like: @dataclassclassMyDataClass:foo:intbar:strbag_dataclass:Bag[MyDataClass]=Bag[MyDataClass](MyDataClass(foo=1,bar='x'))# Happy path examplesbag_dataclass_foo:Bag[int]=bag_dataclass.foofoo:int=bag_dataclass.foo.get()foo_:int=bag_dataclass_foo.get()bag_dataclass_bar:Bag[str]=bag_dataclass.barbar:str=bag_dataclass.bar.get()bar_:str=bag_dataclass_bar.get()classMyTypedDict(TypedDict):foo:intbar:strbag_typeddict:Bag[MyTypedDict]=Bag[MyTypedDict]({'foo':1,'bar':'x'})# Happy path examplesbag_typeddict_foo:Bag[int]=bag_typeddict.foodfoo:int=bag_typeddict.foo.get()dfoo_:int=bag_typeddict_foo.get()bag_typeddict_bar:Bag[str]=bag_typeddict.bardbar:str=bag_typeddict.bar.get()dbar_:str=bag_typeddict_bar.get() I've got thisworkingwith amypy plugin, but how could I get this to work so that pylance, ruff, etc would also work? |
BetaWas this translation helpful?Give feedback.
All reactions
Replies: 3 comments 4 replies
-
Nope, Maybe it is time to start a discussion about potential |
BetaWas this translation helpful?Give feedback.
All reactions
-
Did any progress happen on |
BetaWas this translation helpful?Give feedback.
All reactions
-
nudge on this again... |
BetaWas this translation helpful?Give feedback.
All reactions
-
#1775 seems to be the same ballpark as this... |
BetaWas this translation helpful?Give feedback.
All reactions
-
@sobolevn - I guess that's what I'd feared... do pylance and friends support mypy plugins? |
BetaWas this translation helpful?Give feedback.
All reactions
-
Nope :( |
BetaWas this translation helpful?Give feedback.
All reactions
😕 1
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
Doing the same for the |
BetaWas this translation helpful?Give feedback.