A short example would help. I read all that and I'm still not sure what you 
meant. 

> On 26 Oct 2019, at 13:13, Steve Jorgensen <ste...@stevej.name> wrote:
> 
> After messing around with `Enum` for a while, there's one small thing that 
> I'd like to see improved. It seems limiting to me that the only way to 
> trigger `_generate_next_value` is to pass `auto()`.
> 
> What if, for a particular `Enum`, I would like to be able to use `()` as a 
> shorthand for `auto()`? How about a more complex auto-generation that 
> determines the final value based on both the given value and the name/key
> 
> As an example of the second case, start with an `Enum` subclas in which each 
> item, by default, has the name/key as its value and a prettified version of 
> the name as its label, but one can also specify the value and label using a 
> 2-item tuple for the value. Now, let's say we want to be able to specify a 
> custom label and still use the name/key as the value either as a None/label 
> tuple or as a string starting with a comma.
> 
> Using a custom test for auto, one could identify those cases, Passing the 
> assigned value to the `_generate_next_value_` function would allow it to make 
> use of that information. For backward compatibility, the signature of the 
> `_generate_next_value_` function can be checked to make sure it can accept 
> the extra argument for that before passing that.
> _______________________________________________
> 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/RTH5D7WBI4KBOYHO6WYPNQDGJILLKO5Y/
> Code of Conduct: http://python.org/psf/codeofconduct/
_______________________________________________
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/SVLM7BV5ERUGJUDS6B3ZJDK3BVLFE5NP/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to