Chris Angelico於 2013年5月14日星期二UTC+8上午1時36分34秒寫道: > On Mon, May 13, 2013 at 8:17 PM, Steven D'Aprano > > <steve+comp.lang.pyt...@pearwood.info> wrote: > > > Let's look at his major criticisms: > > > > > > 1) values aren't automatically generated. > > > > > > True. So what? That is the *least* important part of enums. > > > > I stopped following the -ideas threads about enums, but IIRC > > autogeneration of values was in quite a few of the specs early on. So > > you can probably find the arguments against it in the list archives. > > > > FWIW, though, I do like C's autogeneration of enum values - but use it > > in only a small proportion of my enums. It's not a terrible loss, but > > it is a loss. > > > > ChrisA
Because a hash table can replace the enums in other languages, it is more pythonic to use a dictionary built first to replace the enums. I think it is the same style of programming in perl and ruby. -- http://mail.python.org/mailman/listinfo/python-list