<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, May 1, 2013 at 11:59 AM, Georg Brandl <span dir="ltr"><<a href="mailto:g.brandl@gmx.net" target="_blank">g.brandl@gmx.net</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Am 01.05.2013 20:44, schrieb Antoine Pitrou:<br>
<div class="im">> On Wed, 01 May 2013 10:21:30 -0700<br>
> Ethan Furman <<a href="mailto:ethan@stoneleaf.us">ethan@stoneleaf.us</a>> wrote:<br>
>> We may not want to /completely/ disallow subclassing.  Consider:<br>
>><br>
>> --> class StrEnum(str, Enum):<br>
>> ...    '''string enums for Business Basic variable names'''<br>
>> ...<br>
>> --> class Vendors(StrEnum):<br>
>> EnumError: subclassing not allowed<br>
><br>
> I don't see the point of disallowing subclassing. It sounds like<br>
> a pointless restriction.<br>
><br>
> However, perhaps the constructor should forbid the returning of a base<br>
> type, e.g.:<br>
><br>
> class Season(Enum):<br>
>     spring = 1<br>
><br>
> class MySeason(Season):<br>
>     """I look nicer than Season"""<br>
><br>
> MySeason('spring')<br>
> ...<br>
> ValueError: Season.spring is not a MySeason instance<br>
><br>
> (what this means is perhaps the subclassing of non-empty enum classes<br>
> should be forbidden)<br>
<br>
</div>That's exactly what's implemented in the ref435 code at the moment.<br>
<span class="HOEnZb"></span><br></blockquote></div><br></div><div class="gmail_extra">It can't be because __call__ is by-value lookup, not by-name lookup. By-name lookup is Season.spring or getattr(Season, 'spring')<br>

<br>Eli<br><br></div></div>