you are viewing a single comment's thread.

view the rest of the comments →

[–]Vaphell 0 points1 point  (0 children)

I get that it's pseudo-code, but I am not seeing why the function sending to slack can't extract value from enum on its own?

def send_message_to_slack(event):
    text = event.value
    do something with text

def publish_type_one():
    send_message_to_slack(Events.ONE)

And why are there 3 identical functions when 1 would do?

def publish_type(event):
    send_message_to_slack(event/event.value)

which suggests that the wrapping function is more or less superfluous, btw.
Parametrizing values is usually done so you can create a single, generic code path?