diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2015-05-04 19:45:53 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2015-05-04 19:45:53 +0300 |
commit | 5ab5ac5448573fa34cc2316d895706c24a412f36 (patch) | |
tree | 4300caa3782f3d9fd2da31e99117bdc69922d7f9 /py/modbuiltins.c | |
parent | 3d3ef36e977b5f5a4153b8df6447f3f73e4726e3 (diff) | |
download | micropython-5ab5ac5448573fa34cc2316d895706c24a412f36.tar.gz micropython-5ab5ac5448573fa34cc2316d895706c24a412f36.zip |
modbuiltins: Add NotImplemented builtin constant.
From https://docs.python.org/3/library/constants.html#NotImplemented :
"Special value which should be returned by the binary special methods
(e.g. __eq__(), __lt__(), __add__(), __rsub__(), etc.) to indicate
that the operation is not implemented with respect to the other type;
may be returned by the in-place binary special methods (e.g. __imul__(),
__iand__(), etc.) for the same purpose. Its truth value is true."
Some people however appear to abuse it to mean "no value" when None is
a legitimate value (don't do that).
Diffstat (limited to 'py/modbuiltins.c')
-rw-r--r-- | py/modbuiltins.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/py/modbuiltins.c b/py/modbuiltins.c index 455e1cc1b6..9b5bd4c5ed 100644 --- a/py/modbuiltins.c +++ b/py/modbuiltins.c @@ -634,6 +634,9 @@ STATIC const mp_map_elem_t mp_module_builtins_globals_table[] = { // built-in objects { MP_OBJ_NEW_QSTR(MP_QSTR_Ellipsis), (mp_obj_t)&mp_const_ellipsis_obj }, + #if MICROPY_PY_BUILTINS_NOTIMPLEMENTED + { MP_OBJ_NEW_QSTR(MP_QSTR_NotImplemented), MP_OBJ_SENTINEL }, + #endif // built-in user functions { MP_OBJ_NEW_QSTR(MP_QSTR_abs), (mp_obj_t)&mp_builtin_abs_obj }, |