
Evening, 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. 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. I've implemented a similar approach to solve deprecating enum members. You can check it out here: https://github.com/foxyblue/cpython/pull/1

On 7/23/20 12:24 PM, s.williamswynn.mail@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~

On 7/23/20 12:24 PM, s.williamswynn.mail@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~
participants (2)
-
Ethan Furman
-
s.williamswynn.mail@gmail.com