原因:点__class__时,漏写了后面两个下划线
if data.__class.__base__ is not Optional: AttributeError: 'WhereOptional' object has no attribute '_Optional__class'
正确:
if data.__class__.__base__ is not Optional: raise TypeError('函子的返回类型必须是Option的子类') return data