[Python-ideas] Enums
Greg Ewing
greg.ewing at canterbury.ac.nz
Fri Jul 29 01:24:29 CEST 2011
ron3200 wrote:
> When these objects are passed around, (to/from functions or methods),
> they will most likely be rebound to more generic names that don't match
> their string repr anyway.
That doesn't matter, any more than it does for functions
and classes. The point is to associate *some* descriptive
name with the value for display purposes.
> What name would you give...
>
> colors = []
> colors.append(Enum(1))
> assert str(colors[0]) == ?
Obviously you can't infer any descriptive name from that.
Automatic name assignment requires a dedicated syntax, IMO.
We just need to wait for the BDFL to find one that he doesn't
hate. (Or to stop hating one that he currently hates -- it's
happened before...)
--
Greg
More information about the Python-ideas
mailing list