Abdulla Al Kathiri writes:

Condensing to the parts which are in question,

 > def test(self, func: t.Callable[..., bool],   *args, **kwargs) -> Predicate:
 >         return self._build_predicate(
 >                lambda lhs, value: func(lhs, *args, **kwargs),
 >             Operation.TEST,
 >             (self._path, func, args, freeze(kwargs))
 >         ) 

 > def test(self, func: (...) -> bool, *args, **kwargs) -> Predicate:
 >         return self._build_predicate(
 >             (lhs, value) => func(lhs, *args, **kwargs),
 >             Operation.TEST,
 >             (self._path, func, args, freeze(kwargs))
 >         ) 

Yes, it's nicer, but I don't see a win big enough to be worth forcing
people who read code to learn two syntaxes for lambda, and two
syntaxes for Callable (one of which isn't even syntax).  Also, "->"
can't be just syntax, if I understand type annotations correctly.  It
would need to become an object constructor.  Then the question would
be "are there cases where 'Callable' is not what you want there?",
i.e., you want a subclass of Callable.  In that case you'd have to use
the old syntax anyway.  (I don't have an answer to that, but you would
need one.)

I don't make the rules, but to me if this is the best you can do, you
would have to provide evidence that quite a lot of code would benefit
from this.

Steve
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/FE2MEP6SM4ZPAR7KAJME3KVJ6JZQLJV3/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to