问题
While starting to develop a Dropbox app using the Python SDK, I'm tripping conceptually over what the AccessLevel documentation calls a union tag. (The concept extends beyond the AccessLevel class, but this seems like as good an example as any.)
I'm trying to understand why the _tag
attribute basically appears to be intended for internal use only. Why, if I want to know if a user has editor, owner, or viewer permission—-and it can only be one of those--I seem to be supposed to call the is_owner()
, is_editor()
, and is_viewer()
methods until I get a True
response.
What am I missing? Why wouldn't it be a good idea to just access the _tag
attribute and go my merry way?
来源:https://stackoverflow.com/questions/49370075/what-is-a-dropbox-api-v2-union-tag