<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Apr 25, 2013 at 9:39 AM, Ethan Furman <span dir="ltr"><<a href="mailto:ethan@stoneleaf.us" target="_blank">ethan@stoneleaf.us</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 04/25/2013 09:34 AM, Eli Bendersky wrote:<div><div class="h5"><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
<br>
On Thu, Apr 25, 2013 at 8:46 AM, Ethan Furman <<a href="mailto:ethan@stoneleaf.us" target="_blank">ethan@stoneleaf.us</a> <mailto:<a href="mailto:ethan@stoneleaf.us" target="_blank">ethan@stoneleaf.us</a>>> wrote:<br>


<br>
    On 04/25/2013 06:03 AM, Eli Bendersky wrote:<br>
<br>
<br>
        The __call__ syntax has been repurposed for the convenience API:<br>
<br>
        --> Animals = Enum('Animals', 'ant bee cat dog')<br>
        --> Animals<br>
<br>
        <Animals {ant: 1, bee: 2, cat: 3, dog: 4}><br>
        --> Animals.ant<br>
        <EnumValue: Animals.ant [value=1]><br>
        --> Animals.ant.value<br>
<br>
        1<br>
<br>
        The aforementioned deprecated syntax refers to __call__ with a single arguments (the convenience API by definition<br>
        requires more than one).<br>
<br>
<br>
    I don't understand why having Enum() be the convenience function rules out `Animals(1)` from returning `Animals.ant`.<br>
<br>
<br>
Because we already have a way to do that: Animals[1]. Why do you need two slightly different ways to do the same?<br>
Moreover, why do you want to make Animals.__call__ behave very differently based only on the number of args? This seems<br>
to be un-pythonic in multiple ways.<br>
</blockquote>
<br></div></div>
I think we're talking past each other (or I'm not awake yet ;).<br>
<br>
Animals is a class.  Giving Animals a parameter (such as 1 or 'ant') should return the instance that matches.  This is how classes work.<br>
<br>
I don't understand your assertion that there is another way to call Animals... do you mean something like:<br>
<br>
--> MoreAnimals = Animals('MoreAnimals', 'bird worm insect')<br></blockquote></div><br></div><div class="gmail_extra">Yes, this works in the current implementation. But I'm realizing that the recent proposals of making isinstance(Color.red, Color) True will turn things around anyway so this discussion may be moot.<br>

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