mirror of
https://github.com/micropython/micropython.git
synced 2026-01-05 03:30:14 +01:00
py/objarray: Allow extending array with any iterable.
As suggested by @dpgeorge, factor out part of array_construct to allow it to be used for construction & extension. Note that extending with a known-length list (or tuple) goes through the slow path of calling array_extend once per element. Fixes issue #7408. Signed-off-by: Jeff Epler <jepler@gmail.com>
This commit is contained in:
committed by
Damien George
parent
c1629dc2ff
commit
0a98f3a911
@@ -14,3 +14,9 @@ print(a1)
|
||||
|
||||
a1.extend(array.array('I', [5]))
|
||||
print(a1)
|
||||
|
||||
a1.extend([6, 7])
|
||||
print(a1)
|
||||
|
||||
a1.extend(i for i in (8, 9))
|
||||
print(a1)
|
||||
|
||||
Reference in New Issue
Block a user