On Tue, Nov 23, 2010 at 2:46 AM, <exar...@twistedmatrix.com> wrote: > On 04:24 pm, solip...@pitrou.net wrote: >> >> On Mon, 22 Nov 2010 17:08:36 +0100 >> Hrvoje Niksic <hrvoje.nik...@avl.com> wrote: >>> >>> On 11/22/2010 04:37 PM, Antoine Pitrou wrote: >>> > +1. The problem with int constants is that the int gets printed, not >>> > the name, when you dump them for debugging purposes :) >>> >>> Well, it's trivial to subclass int to something with a nicer __repr__. >>> PyGTK uses that technique for wrapping C enums: >> >> Nice. It might be useful to add a private _Constant class somewhere for >> stdlib purposes. > > http://www.python.org/dev/peps/pep-0354/
Indeed, it is difficult to do enums is such a way that they feel sufficiently robust to be worth the effort of including them (although these days, I would be inclined to follow the namedtuple API style rather than that presented in PEP 354). Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia _______________________________________________ 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