[Python-3000] Requiring () around lambda's argument list

Guido van Rossum guido at python.org
Wed May 3 01:45:51 CEST 2006


On 5/2/06, Jim Jewett <jimjjewett at gmail.com> wrote:
> On 5/1/06, Guido van Rossum <guido at python.org> wrote:
> >... I'm settled on the following syntax for adding optional annotations
>
> >   def foo(arg1name: typeexpr = defaultexpr, arg2: typeexpr =
> > defaultexpr, ...): ...
>
> Did you also decide that the annotations will have no effect by
> themselves, and will rely on, for example, a decorator?...

Right. It doesn't have to be a decorator though -- it could be some
other kind of introspection.

> >   lambda arg1name : ...
>
> If something is worth decorating, it is worth naming.
>
> If you even need to *document* restrictions on the argument (beyond
> what you can get easily from the name or context), then the function
> is a little too fancy for a lambda.

Depends on what you use the annotations for. If you have a framework
that uses annotations to guide some kidn of adaptation machinery, I
could imagine a use for a lambda with an annotation. But I'll happily
say YAGNI...

--
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-3000 mailing list