Message189142
| Author |
barry |
| Recipients |
barry, ethan.furman, ncoghlan, pitrou |
| Date |
2013年05月13日.15:09:31 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<20130513110927.20cbead5@anarchist> |
| In-reply-to |
<1172298768.36174760.1368453982354.JavaMail.root@zimbra10-e2.priv.proxad.net> |
| Content |
On May 13, 2013, at 02:06 PM, Antoine Pitrou wrote:
>Antoine Pitrou added the comment:
>
>> >I agree with Nick here, there's no reason to auto-number constants
>> >in
>> >Python. This is not C :-)
>>
>> Why should they be strings? Why not object()?
>
>Because strings are readable, I'd say.
The repr would then be
<Color.red: Color.red>
Yuck.
Also, you would have to allow for subclasses (e.g. IntEnum) to override
auto-assignment. Clearly, you can't use strings for
X = IntEnum('X', 'start middle end') |
|