Ethan Furman added the comment:
I would like to add a function that can be used when creating a Flag (and Enum,
but that's less important) that will generate the next value.
This is important because in Flag the values are an important internal detail,
but are largely irrelevant to the user (if they weren't then an IntFlag is
probably more appropriate).
Actually, this function already exists and is used to supply the values when
using the Functional API: _generate_next_value_ . But that's a bit clunky for
use during class definition:
class Color(Flag):
red = _generate_next_value_()
blue = _generate_next_value_()
green = _generate_next_value_()
What would be a better name for class use?
- _next_value_
- _value_
- _flag_
- _next_flag_
Any others?
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue23591>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com