Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
micropython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
micropython
Commits
9a2913ed
Commit
9a2913ed
authored
Aug 02, 2015
by
Damien George
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
py/objlist: Make list += accept all arguments and add test.
parent
c6926c37
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
3 deletions
+33
-3
py/objlist.c
py/objlist.c
+0
-3
tests/basics/list_extend.py
tests/basics/list_extend.py
+33
-0
No files found.
py/objlist.c
View file @
9a2913ed
...
...
@@ -121,9 +121,6 @@ STATIC mp_obj_t list_binary_op(mp_uint_t op, mp_obj_t lhs, mp_obj_t rhs) {
return
MP_OBJ_UNCAST
(
s
);
}
case
MP_BINARY_OP_INPLACE_ADD
:
{
if
(
!
MP_OBJ_IS_TYPE
(
rhs
,
&
mp_type_list
))
{
return
MP_OBJ_NULL
;
// op not supported
}
list_extend
(
lhs
,
rhs
);
return
lhs
;
}
...
...
tests/basics/list_extend.py
0 → 100644
View file @
9a2913ed
# test list.__iadd__ and list.extend (they are equivalent)
l
=
[
1
,
2
]
l
.
extend
([])
print
(
l
)
l
.
extend
([
3
])
print
(
l
)
l
.
extend
([
4
,
5
])
print
(
l
)
l
.
extend
(
range
(
6
,
10
))
print
(
l
)
l
.
extend
(
"abc"
)
print
(
l
)
l
=
[
1
,
2
]
l
+=
[]
print
(
l
)
l
+=
[
3
]
print
(
l
)
l
+=
[
4
,
5
]
print
(
l
)
l
+=
range
(
6
,
10
)
print
(
l
)
l
+=
"abc"
print
(
l
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment