[redirecting back to the list]

On 04/19/2017 11:15 PM, Stephan Hoyer wrote:
Ethan and Steven,

Thanks for your feedback on this one. I agree that it probably doesn't make 
sense for the standard library.

I'm still not really happy with any of the standard approaches for choosing a 
function based on an enum value -- they
all seem pretty verbose/ugly -- but clearly I'm bothered by this more than 
most, and the standard library is not a good
place for novel solutions.

I'm curious, what did you find ugly with:

    class TestEnum(CallableEnum):

         @enum
         def hello(text):
             "a pleasant greeting"
             print('hello,', text)

         @enum
         def goodbye(text):
             print('goodbye,', text)

--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to