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

Random832 random832 at fastmail.com
Mon Jan 18 11:54:32 EST 2016



> >> >2016-01-16 12:06 GMT+01:00 Petr Viktorin<encukou at gmail.com>:
> >>> >>The PEP is designed optimizers. It would be good to stick to that use
> >>> >>case, at least as far as the registration is concerned. I suggest noting
> >>> >>in the documentation that Python semantics*must*  be preserved, and
> >>> >>renaming the API, e.g.::
> >>> >>
> >>> >>     sys.set_global_optimizers([])

> > On 17 January 2016 at 21:48, Victor Stinner<victor.stinner at gmail.com>  wrote:
> >> >I would prefer to not restrict the PEP to a specific usage.

> 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.


More information about the Python-ideas mailing list