From cefcbb22b2befac1baa9953c477fcee4031635d3 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Fri, 27 Feb 2015 22:16:05 +0200 Subject: objarray: Implement array slice assignment. This is rarely used feature which takes enough code to implement, so is controlled by MICROPY_PY_ARRAY_SLICE_ASSIGN config setting, default off. But otherwise it may be useful, as allows to update arbitrary-sized data buffers in-place. Slice is yet to implement, and actually, slice assignment implemented in such a way that RHS of assignment should be array of the exact same item typecode as LHS. CPython has it more relaxed, where RHS can be any sequence of compatible types (e.g. it's possible to assign list of int's to a bytearray slice). Overall, when all "slice write" features are implemented, it may cost ~1KB of code. --- unix/mpconfigport.h | 1 + 1 file changed, 1 insertion(+) (limited to 'unix') diff --git a/unix/mpconfigport.h b/unix/mpconfigport.h index bbfae7b21..8c2891563 100644 --- a/unix/mpconfigport.h +++ b/unix/mpconfigport.h @@ -60,6 +60,7 @@ #define MICROPY_PY_BUILTINS_COMPILE (1) #define MICROPY_PY_MICROPYTHON_MEM_INFO (1) #define MICROPY_PY_ALL_SPECIAL_METHODS (1) +#define MICROPY_PY_ARRAY_SLICE_ASSIGN (1) #define MICROPY_PY_SYS_EXIT (1) #define MICROPY_PY_SYS_PLATFORM "linux" #define MICROPY_PY_SYS_MAXSIZE (1) -- cgit v1.2.3