diff options
author | Damien George <damien.p.george@gmail.com> | 2014-05-06 16:38:54 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-05-06 16:38:54 +0000 |
commit | 491cbd6a7cd0a212e28c548789db432b4e64327e (patch) | |
tree | 5e8ff14972d26e05c7ef5f047f6f1c799836fc40 /py/argcheck.c | |
parent | 33b3a6905d30157efa8393893fd11a5104834354 (diff) | |
download | micropython-491cbd6a7cd0a212e28c548789db432b4e64327e.tar.gz micropython-491cbd6a7cd0a212e28c548789db432b4e64327e.zip |
py: Add keyword arg support to enumerate constructor.
Need to have a policy as to how far we go adding keyword support to
built ins. It's nice to have, and gets better CPython compatibility,
but hurts the micro nature of uPy.
Addresses issue #577.
Diffstat (limited to 'py/argcheck.c')
-rw-r--r-- | py/argcheck.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/py/argcheck.c b/py/argcheck.c index 924a60c455..bb26bd3aea 100644 --- a/py/argcheck.c +++ b/py/argcheck.c @@ -103,3 +103,9 @@ void mp_arg_parse_all(uint n_pos, const mp_obj_t *pos, mp_map_t *kws, uint n_all nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError, "extra keyword arguments given")); } } + +void mp_arg_parse_all_kw_array(uint n_pos, uint n_kw, const mp_obj_t *args, uint n_allowed, const mp_arg_t *allowed, mp_arg_val_t *out_vals) { + mp_map_t kw_args; + mp_map_init_fixed_table(&kw_args, n_kw, args + n_pos); + mp_arg_parse_all(n_pos, args, &kw_args, n_allowed, allowed, out_vals); +} |