From 170a8f61e1587af8dde1ba92be8ae5bd3b9e3c65 Mon Sep 17 00:00:00 2001 From: Stefan Krah Date: Thu, 14 Mar 2013 15:18:24 +0100 Subject: [PATCH] Add fork_exec example. --- pep-0437.txt | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/pep-0437.txt b/pep-0437.txt index c3eea0df9..c1bf09051 100644 --- a/pep-0437.txt +++ b/pep-0437.txt @@ -261,6 +261,28 @@ formatted this way:: /*[define_output_end]*/ +Benefits of a compact notation +============================== + +The advantages of a concise notation are especially obvious when a large +number of parameters is involved. The argument parsing part of +``_posixsubprocess.fork_exec`` is fully specified by this definition:: + + /*[define subprocess_fork_exec] + def _posixsubprocess.fork_exec( + process_args: "O", executable_list: "O", + close_fds: "p", py_fds_to_keep: "O", + cwd_obj: "O", env_list: "O", + p2cread: "i", p2cwrite: "i", c2pread: "i", c2pwrite: "i", + errread: "i", errwrite: "i", errpipe_read: "i", errpipe_write: "i", + restore_signals: "i", call_setsid: "i", preexec_fn: "i", /) -> int: pass + [define_end]*/ + + +Note that the *preprocess* tool currently emits a redundant C-declaration +section for this example, so the output is longer than necessary. + + Easy validation of the definition =================================