Le mardi 23 novembre 2010 à 15:40 +0000, Michael Foord a écrit : > On 23/11/2010 15:30, Antoine Pitrou wrote: > > Le mardi 23 novembre 2010 à 15:15 +0000, Michael Foord a écrit : > >> There are still two reasonable APIs (unless you have changed your mind > >> and think that sticking with plain integers is best), of which I prefer > >> the latter: > >> > >> SOME_CONST = Constant('SOME_CONST', 1) > >> OTHER_CONST = Constant('OTHER_CONST', 2) > >> > >> or: > >> > >> Constants = make_constants('Constants', 'SOME_CONST OTHER_CONST', start=1) > > Or: > > > > Constants = make_constants('Constants', 'SOME_CONST OTHER_CONST', > > values=range(1, 3)) > > > > Again, auto-enumeration is useless since it's trivial to achieve > > explicitly. > > Ah, I see. It is the auto-enumeration you disliked. Sure - not a problem. > > I think the step that Nick described, of evaluating places in the > standard library that this could be used, is a good one. I'll try to get > around to it and perhaps attempt to resuscitate the PEP. (Any > suggestions as to an appropriate module if having it live in its own > module is still an objection?)
We already have a bunch of bizarrely unrelated stuff in collections (such as Callable), so we could put enum there too. Regards Antoine. _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com