On 7/23/20 12:24 PM, s.williamswynn.m...@gmail.com wrote:

I have run into a situations when an enum member becomes obsolete.
However, I'd like to avoid removing the member from the enum to give time for 
users to catch up to a libraries core types.

This would be good.

I've seen Java has a @Deprecated annotation for their Enums.
Python enum's can also set an _ignore_ attribute which will avoid instantiating 
a member in the list.

The purpose behind _ignore_ is to be able to use temporary variables without those variables becoming members.

I've implemented a similar approach to solve deprecating enum members.

You can check it out here: https://github.com/foxyblue/cpython/pull/1

Interesting.  I prefer the approach in my Stackoverflow answer:

  https://stackoverflow.com/a/62309159/208880

Yours is quite similar, but mine is more general-purpose and so easily allows for a useful message as well.

--
~Ethan~
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/2QYCUQRJUTNQOFHVWGDNIYW2RHUAXDSL/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to