Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
513e6567
Commit
513e6567
authored
Feb 02, 2014
by
Paul Sokolovsky
Browse files
Add testcase for sequence unpacking.
parent
edbdf71f
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/basics/seq-unpack.py
0 → 100644
View file @
513e6567
# Basics
a
,
b
=
1
,
2
print
(
a
,
b
)
a
,
b
=
(
1
,
2
)
print
(
a
,
b
)
(
a
,
b
)
=
1
,
2
print
(
a
,
b
)
(
a
,
b
)
=
(
1
,
2
)
print
(
a
,
b
)
# Tuples/lists are optimized
a
,
b
=
[
1
,
2
]
print
(
a
,
b
)
[
a
,
b
]
=
100
,
200
print
(
a
,
b
)
try
:
a
,
b
,
c
=
(
1
,
2
)
except
ValueError
:
print
(
"ValueError"
)
try
:
a
,
b
,
c
=
[
1
,
2
,
3
,
4
]
except
ValueError
:
print
(
"ValueError"
)
# Generic iterable object
a
,
b
,
c
=
range
(
3
)
print
(
a
,
b
,
c
)
try
:
a
,
b
,
c
=
range
(
2
)
except
ValueError
:
print
(
"ValueError"
)
try
:
a
,
b
,
c
=
range
(
4
)
except
ValueError
:
print
(
"ValueError"
)
Write
Preview
Supports
Markdown
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