1

I need a way to get the parameter that was sent name.
for example

class Message:  
    I = 1
    LIKE = 2
    COODING = 3

sendData(Message.LIKE)


def sendData(arg):
    print(arg.name) -> Message.LIKE
    print(arg.value) -> 2

And before some says use class Message(Enum): this is prebuilt Class so I can't change the class itself.

I have tried stuff like

sendData(enum(Message.LIKE))

and check via inspect module the method call signature with no luck

EDIT: This is no duplicated, as I says. I cant change class Message to class Message(Enum)

0 Answers0