This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ethan.furman
Recipients barry, eli.bendersky, ethan.furman, ezio.melotti, martin.panter, python-dev, r.david.murray, rhettinger, serhiy.storchaka, veky, vstinner
Date 2016-09-07.15:35:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1473262501.2.0.92740020938.issue23591@psf.upfronthosting.co.za>
In-reply-to
Content
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?
History
Date User Action Args
2016-09-07 15:35:01ethan.furmansetrecipients: + ethan.furman, barry, rhettinger, vstinner, ezio.melotti, r.david.murray, eli.bendersky, python-dev, martin.panter, serhiy.storchaka, veky
2016-09-07 15:35:01ethan.furmansetmessageid: <1473262501.2.0.92740020938.issue23591@psf.upfronthosting.co.za>
2016-09-07 15:35:01ethan.furmanlinkissue23591 messages
2016-09-07 15:35:01ethan.furmancreate