Damien George
6d3c5e4301
Add ARRAY_SIZE macro, and use it where possible.
11 years ago
Damien George
107c9fb235
py: Make collections module configurable, enabled by default.
11 years ago
Damien George
71d3112f7e
py: Make built-in 'range' a class.
Addresses issue #487 .
11 years ago
Damien George
dbdfee15a1
py: Add cmath module, for complex math. Disabled by default.
Not all functions implemented. Not enabled on pyboard.
11 years ago
Damien George
897fe0c0d0
py: Add builtin functions bin and oct, and some tests for them.
11 years ago
Damien George
5805111732
py: Add hex builtin function.
A one-liner, added especially for @pfalcon :)
11 years ago
Damien George
777b0f32f4
py: Add property object, with basic functionality.
Enabled by MICROPY_ENABLE_PROPERTY.
11 years ago
Damien George
49f20b841d
py: Add more #if's for configurable MOD_SYS.
11 years ago
Paul Sokolovsky
48fdaad824
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.
11 years ago
Paul Sokolovsky
5500cdeec7
py, unix: Convert sys module to static representation.
11 years ago
Paul Sokolovsky
e9db840480
py: Start implementing "struct" module.
Only calcsize() and unpack() functions provided so far, for little-endian
byte order. Format strings don't support repition spec (like "2b3i").
Unfortunately, dealing with all the various binary type sizes and alignments
will lead to quite a bloated "binary" helper functions - if optimizing for
speed. Need to think if using dynamic parametrized algos makes more sense.
11 years ago
Paul Sokolovsky
4dcb605ac4
py: Make bytearray a proper type.
11 years ago
Paul Sokolovsky
cc0af3d727
py: Implement globals() and locals() builtins.
11 years ago
Damien George
7efc5b3f34
py: Make globals and locals proper dictionary objects.
Finishes addressing issue #424 .
In the end this was a very neat refactor that now makes things a lot
more consistent across the py code base. It allowed some
simplifications in certain places, now that everything is a dict object.
Also converted builtins tables to dictionaries. This will be useful
when we need to turn builtins into a proper module.
11 years ago
Paul Sokolovsky
c6813d92db
py: Put default namespace into module __main__.
That's how CPython has it, in particular, "import __main__" should work.
11 years ago
Paul Sokolovsky
98a627dc03
py: Add "io" module.
So far just includes "open" function, which should be supplied by a port.
TODO: Make the module #ifdef'ed.
11 years ago
Damien George
3e1a5c10c5
py: Rename old const type objects to mp_type_* for consistency.
11 years ago
Damien George
07ddab529c
py: Change mp_const_* objects to macros.
Addresses issue #388 .
11 years ago
Damien George
c63f984647
py: Thin out predefined exceptions.
Only exceptions that are actually used are left prefedined. Hierarchy
is still there, and removed exceptions are just commented out.
11 years ago
Paul Sokolovsky
e9137b94f2
py: Implement getattr() builtin.
11 years ago
Damien George
ffb5cfc8d8
py: Removed some unnecessary exception objects.
They still exist in commented-out form in objexcept.c if they are ever
needed.
11 years ago
Damien George
caac542b23
Proper support for registering builtin modules in ROM.
Comes with some refactoring of code and renaming of files. All modules
are now named mod*.[ch].
11 years ago