Author ethan.furman
Recipients barry, eli.bendersky, ethan.furman, ezio.melotti, python-dev, r.david.murray, rhettinger, serhiy.storchaka, veky
Date 2016-09-11.14:57:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1473605873.69.0.606078760457.issue23591@psf.upfronthosting.co.za>
In-reply-to
Content
>> Which means it has methods such as __getitem__, __setitem__, etc.,
>> which means those methods can implement whatever is needed to give
>> the namespace the desired semantics (within Python syntax).

> Ah, _that_'s what you had in mind. (All this time, I thought _auto_
> was just a shorter name for _generate_next_value_.:) I'm ok with that.
> But aren't we then back to square one? (Using magic of the same kind
> as the "declarative style" that Raymond pronounced not Pythonic enough.)

Not at all.  The concern with that proposal (issue26988: AutoEnum via completely omitting values of any kind) was the transformation of a NameError into a value.  The current method is taking a unique object and transforming that into a value, which is entirely analagous to what Enum already does.

Besides being convenient, it's also necessary to present a cohesive, non-leaky abstraction to the user where Flag is concerned: using ints as the flag values is entirely an implementation detail, but without auto the user would be forced to manage that implementation detail when creating the Flag, which negates much of Flag's value.
History
Date User Action Args
2016-09-11 14:57:53ethan.furmansetrecipients: + ethan.furman, barry, rhettinger, ezio.melotti, r.david.murray, eli.bendersky, python-dev, serhiy.storchaka, veky
2016-09-11 14:57:53ethan.furmansetmessageid: <1473605873.69.0.606078760457.issue23591@psf.upfronthosting.co.za>
2016-09-11 14:57:53ethan.furmanlinkissue23591 messages
2016-09-11 14:57:53ethan.furmancreate