[Python-ideas] Syntax for easy binding __name__, __module__, __qualname__ to arbitrary objects

Guido van Rossum guido at python.org
Mon May 13 19:01:03 CEST 2013


On Mon, May 13, 2013 at 8:49 AM, Jim Jewett <jimjjewett at 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.

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)


More information about the Python-ideas mailing list