[Python-ideas] PEP 511: API for code transformers

Yury Selivanov yselivanov.ml at gmail.com
Mon Jan 18 12:04:31 EST 2016


[..]
>> On 2016-01-17 7:36 AM, Nick Coghlan wrote:
>>> The problem I see with making the documentation and naming too generic
>>> is that people won't know what the feature is useful for - a generic
>>> term like "transformer" accurately describes these units of code, but
>>> provides no hint as to why a developer might care about their
>>> existence.
>>>
>>> However, if the reason we're adding the capability is to make global
>>> static optimizers feasible, then we cam describe it accordingly (so
>>> the answer to "Why does this feature exist?" becomes relatively self
>>> evident), and have the fact that the feature can actually be used for
>>> arbitrary transforms be an added bonus rather than the core intent.
> On Mon, Jan 18, 2016, at 11:45, Yury Selivanov wrote:
>> +1.
> I think that it depends on how it's implemented. Having a _requirement_
> that semantics _must_ be preserved suggests that they may not always be
> applied, or may not be applied in a deterministic order.

It just won't be possible to enforce that "requirement".

What Nick suggests (and I suggested in my email earlier in
this thread) is that we should name the APIs clearly to avoid
any confusion.

`sys.set_code_transformers` is less clear about what it should
be used for than `sys.set_code_optimizers`.

Yury


More information about the Python-ideas mailing list