On 04/25/2013 09:34 AM, Eli Bendersky wrote:




On Thu, Apr 25, 2013 at 8:46 AM, Ethan Furman <ethan@stoneleaf.us ethan@stoneleaf.us>> wrote:
">

(original) (raw)




On Thu, Apr 25, 2013 at 9:39 AM, Ethan Furman <ethan@stoneleaf.us> wrote:
On 04/25/2013 09:34 AM, Eli Bendersky wrote:




On Thu, Apr 25, 2013 at 8:46 AM, Ethan Furman <ethan@stoneleaf.us ethan@stoneleaf.us>> wrote:

� � On 04/25/2013 06:03 AM, Eli Bendersky wrote:


� � � � The \_\_call\_\_ syntax has been repurposed for the convenience API:

� � � � --> Animals = Enum('Animals', 'ant bee cat dog')
� � � � --> Animals

� � � �
� � � � --> Animals.ant
� � � �
� � � � --> Animals.ant.value

� � � � 1

� � � � The aforementioned deprecated syntax refers to \_\_call\_\_ with a single arguments (the convenience API by definition
� � � � requires more than one).


� � I don't understand why having Enum() be the convenience function rules out \`Animals(1)\` from returning \`Animals.ant\`.


Because we already have a way to do that: Animals\[1\]. Why do you need two slightly different ways to do the same?
Moreover, why do you want to make Animals.\_\_call\_\_ behave very differently based only on the number of args? This seems
to be un-pythonic in multiple ways.

I think we're talking past each other (or I'm not awake yet ;).

Animals is a class. �Giving Animals a parameter (such as 1 or 'ant') should return the instance that matches. �This is how classes work.

I don't understand your assertion that there is another way to call Animals... do you mean something like:

\--> MoreAnimals = Animals('MoreAnimals', 'bird worm insect')

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.


Eli