[Python-Dev] [Python-checkins] peps: New DSL syntax and slightly changed semantics for the Argument Clinic DSL.

Nick Coghlan ncoghlan at gmail.com
Mon Mar 18 16:50:08 CET 2013


On Mon, Mar 18, 2013 at 3:13 AM, Stefan Krah <stefan at bytereef.org> wrote:
> Larry Hastings <larry at hastings.org> wrote:
>>     So I hope that at least converters can be declared statically in a header
>>     file, like I suggested in PEP 437.
>>
>>
>> The Argument Clinic prototype is written in Python; I don't know how "declared
>> static in a header file" applies to a Python implementation.  Currently the
>> converters are declared directly in clinic.py, somewhere in the middle.
>
> It applies in the same way to a Python implementation as declaring the
> DSL comment blocks in a C file applies to a Python implementation. This
> is exactly the same.
>
> 1) I think that third party tools should be able to extract *all* required
>    information from the DSL only.
>
> 2) After writing a new custom converter, I'd rather edit a header file and
>    not the preprocessor source.
>
> 3) Likewise, I'd rather edit a header file than inserting a magic [python]
>    block into the C source that registers the required information with
>    the preprocessor in a completely implementation defined way.

We didn't spend much time on this (we were focused on the per-function
DSL), but I agree a DSL for converters would be highly desirable, and
quite like the one in PEP 437.

It would require some tweaks to correctly handle the converter
parameterisation (for example, in the "es#" case, "encoding" is an
input to the converter rather than an output. This is why PEP 436 now
allows a callable notation for type converter references)

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-Dev mailing list