In set theory you can subtract set B from set A to derive a new set consisting of members that are in A but not in B.
A = {x,y,z}
B = {z}
C = A - B = {x,y}
I want to achieve this in Python by subtracting two TypedDicts
to derive a new type annotation
class A(TypedDict):
x: int
y: int
z: int
class B(TypedDict):
z: int
C = type(A - B) # <- fake code, what I'm looking for
def f() -> C:
return {'x':0,'y':0}
Languages like TypeScript seem to support this operation. Does Python?