比如说,我有两种类型
A
B
在 TypeScript 中,我会使用
&
A & B
https://ultimatecourses.com/blog/use-intersection-types-to-combine-types-in-typescript
如何在 Python 中实现相同的效果?
您只需将
|
x: A | B = A()