py: Rename collections module to _collections.

We're not going to implement all the plethora of types in there in C.
Funnily, CPython implements defaultdict in C, and namedtuple in Python.
This commit is contained in:
Paul Sokolovsky 2014-04-13 10:17:04 +03:00
parent ef79a82cec
commit 48fdaad824
4 changed files with 8 additions and 5 deletions

View File

@ -126,7 +126,7 @@ STATIC const mp_map_elem_t mp_builtin_module_table[] = {
#if MICROPY_ENABLE_MOD_IO
{ MP_OBJ_NEW_QSTR(MP_QSTR_io), (mp_obj_t)&mp_module_io },
#endif
{ MP_OBJ_NEW_QSTR(MP_QSTR_collections), (mp_obj_t)&mp_module_collections },
{ MP_OBJ_NEW_QSTR(MP_QSTR__collections), (mp_obj_t)&mp_module_collections },
#if MICROPY_ENABLE_MOD_STRUCT
{ MP_OBJ_NEW_QSTR(MP_QSTR_struct), (mp_obj_t)&mp_module_struct },
#endif

View File

@ -5,7 +5,7 @@
#include "builtin.h"
STATIC const mp_map_elem_t mp_module_collections_globals_table[] = {
{ MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_collections) },
{ MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR__collections) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_namedtuple), (mp_obj_t)&mp_namedtuple_obj },
};
@ -22,6 +22,6 @@ STATIC const mp_obj_dict_t mp_module_collections_globals = {
const mp_obj_module_t mp_module_collections = {
.base = { &mp_type_module },
.name = MP_QSTR_collections,
.name = MP_QSTR__collections,
.globals = (mp_obj_dict_t*)&mp_module_collections_globals,
};

View File

@ -90,7 +90,7 @@ Q(calcsize)
#endif
Q(chr)
Q(classmethod)
Q(collections)
Q(_collections)
Q(complex)
Q(dict)
Q(dir)

View File

@ -1,4 +1,7 @@
from collections import namedtuple
try:
from collections import namedtuple
except ImportError:
from _collections import namedtuple
T = namedtuple("Tup", "foo bar")
# CPython prints fully qualified name, what we don't bother to do so far