[Python-ideas] Faster PyArg_ParseTupleAndKeywords kwargs
Nathaniel Smith
njs at pobox.com
Fri May 23 22:38:40 CEST 2014
On Fri, May 23, 2014 at 9:22 PM, <dw+python-ideas at hmmz.org> wrote:
> On Fri, May 23, 2014 at 09:08:28PM +0100, Nathaniel Smith wrote:
>
>> You should check out Argument Clinic (PEP 436) if you haven't seen it.
>
> Thanks! I'd seen this but forgotten about it. The use of a preprocessor
> seems excessive, and a potential PITA when combined with other
> preprocessors - e.g. Qt's moc, but the language is a very cool idea.
Yes, but OTOH it's working and shipping code with a substantial user
base (lots of the CPython implementation), so making it fast and
usable in third-party libraries might still be the most efficient
approach. And IIRC it's not (necessarily) a build-time thing, the
usual mode is for it to update your checked-in source directly, so
integration with other preprocessors might be a non-issue.
A preprocessor approach might make it easier to support older Python's
in the generated code, compared to a library approach. (It's easier to
say "developers/the person making the source release must have Python
3 installed, but the generated code works everywhere" than to say
"this library only works on Python 3.5+ because that's the first
version that ships the new argument parsing API".)
-n
--
Nathaniel J. Smith
Postdoctoral researcher - Informatics - University of Edinburgh
http://vorpus.org
More information about the Python-ideas
mailing list