Commit 48fdaad8 authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

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.
parent ef79a82c
...@@ -126,7 +126,7 @@ STATIC const mp_map_elem_t mp_builtin_module_table[] = { ...@@ -126,7 +126,7 @@ STATIC const mp_map_elem_t mp_builtin_module_table[] = {
#if MICROPY_ENABLE_MOD_IO #if MICROPY_ENABLE_MOD_IO
{ MP_OBJ_NEW_QSTR(MP_QSTR_io), (mp_obj_t)&mp_module_io }, { MP_OBJ_NEW_QSTR(MP_QSTR_io), (mp_obj_t)&mp_module_io },
#endif #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 #if MICROPY_ENABLE_MOD_STRUCT
{ MP_OBJ_NEW_QSTR(MP_QSTR_struct), (mp_obj_t)&mp_module_struct }, { MP_OBJ_NEW_QSTR(MP_QSTR_struct), (mp_obj_t)&mp_module_struct },
#endif #endif
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#include "builtin.h" #include "builtin.h"
STATIC const mp_map_elem_t mp_module_collections_globals_table[] = { 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 }, { 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 = { ...@@ -22,6 +22,6 @@ STATIC const mp_obj_dict_t mp_module_collections_globals = {
const mp_obj_module_t mp_module_collections = { const mp_obj_module_t mp_module_collections = {
.base = { &mp_type_module }, .base = { &mp_type_module },
.name = MP_QSTR_collections, .name = MP_QSTR__collections,
.globals = (mp_obj_dict_t*)&mp_module_collections_globals, .globals = (mp_obj_dict_t*)&mp_module_collections_globals,
}; };
...@@ -90,7 +90,7 @@ Q(calcsize) ...@@ -90,7 +90,7 @@ Q(calcsize)
#endif #endif
Q(chr) Q(chr)
Q(classmethod) Q(classmethod)
Q(collections) Q(_collections)
Q(complex) Q(complex)
Q(dict) Q(dict)
Q(dir) Q(dir)
......
from collections import namedtuple try:
from collections import namedtuple
except ImportError:
from _collections import namedtuple
T = namedtuple("Tup", "foo bar") T = namedtuple("Tup", "foo bar")
# CPython prints fully qualified name, what we don't bother to do so far # CPython prints fully qualified name, what we don't bother to do so far
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment