Home >Backend Development >Python Tutorial >Can I retrieve the original variable name when returning an enum from a function?
Retrieving Original Variable Names after Invocation
When returning enum variables from functions, is it possible to retain their original names (e.g., myEnum.SomeNameA) instead of just their values?
Short Answer: No
Long Answer:
While this is technically possible through complex hacks involving traceback and introspection, it's generally discouraged for production code.
To address the underlying requirement, consider exploring workarounds that translate the returned values back into their original names or representative strings. Provide additional code samples and context to facilitate further assistance.
The above is the detailed content of Can I retrieve the original variable name when returning an enum from a function?. For more information, please follow other related articles on the PHP Chinese website!