[Python-Dev] functools.compose to chain functions together

"Martin v. Löwis" martin at v.loewis.de
Mon Aug 17 23:01:50 CEST 2009

> I have never found these arguments compelling. They are obviously not
> true (e.g., itertools.compress()[1] added in 2.7/3.1), and so what I
> really hear is: "I don't like it and I outrank you."

That certainly contributes to it - if you are not a committer, you have
to find a committer that finds the feature important enough to work with
you to integrate it.

Fortunately, there is a process to overcome this problem: the PEP
process. If you you really really want the feature, and can't find
a committer that supports it yet, write a PEP. Then it will be up
to Guido van Rossum to reject it.

> The same reasoning would seem to apply here. In the OP's example, the
> meta-decorator becomes opaque due to the use of a lambda. If one could
> introspect a compose(), then introspection tools could actually know the
> set of decorators being applied. As it is, the "preferred" method of
> using a lambda actually makes it quite hard to know anything.

That makes it even more necessary to write a PEP. I would have never
guessed that introspection on the compose result is desirable. AFAICT,
operator.attrgetter isn't introspectable, either, nor would the patch
proposed in #7762 give you an introspectable getter.

ISTM that people have fairly different requirements wrt. that feature.


More information about the Python-Dev mailing list