On 13 May 2013, at 18:01, Guido van Rossum <guido@python.org> wrote:
On Mon, May 13, 2013 at 8:49 AM, Jim Jewett <jimjjewett@gmail.com> wrote:
The problem with
Animals = Enum('Animals', 'dog cat bird')
is that you might accidentally type
Animals = Enum('Animal', 'dog cat bird') or Anmals = Enum('Animals', 'dog cat bird')
instead.
Sure. But coming up with a syntactic solution for this issue is not easy. So far all the proposals from this thread (and from past threads trying to address the same issues, including PEP 403) look terrible to me -- none of the proposals are more than random permutations of symbols that are currently syntactically invalid are given a fairly random new meaning.
Guido, it sounds like you are not completely opposed to the general idea here, but rather find all the proposed syntaxes to be ugly? This also ties in to your comments about the getframe hack in the new Enum implementation - I think everyone fully agrees with your comments about making things easier for everyone, I'm just not so sure that stack introspection is the best solution, irrespective of the difficulty of implementation in other implementations. It just feels too "magic" and implicit - and we all know explicit is better. Bruce Leban just today on another python-ideas thread said something far more clearly than I ever could to explain why the "def Foo = <expr>" syntax feels "right" to me; to quote, including his example: Def is not a constructor. It is an assignment statement. def f(x): return x+1 f = lambda x: x+1 are equivalent. With this interpretation of def, it feels perfect. :-) Anyway, just my 2 cents. Cheers, Martin
So in the mean time please live with the slight redundancy in this case. Next time you may want to try and design syntax so that you won't have to type the same method name twice when you're defining a function and later calling it. :-)
-- --Guido van Rossum (python.org/~guido) _______________________________________________ Python-ideas mailing list Python-ideas@python.org http://mail.python.org/mailman/listinfo/python-ideas