Skip to content

Commit 800cdf5

Browse files
authored
Merge pull request #242 from 100cube/about_lists-unpacking
Minor addition to list assignments (*splat unpacking with fewer values)
2 parents 84981e3 + 7ec1357 commit 800cdf5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

koans/about_list_assignments.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ def test_parallel_assignments_with_extra_values(self):
2323
self.assertEqual(__, first_names)
2424
self.assertEqual(__, last_name)
2525

26+
def test_parallel_assignments_with_fewer_values(self):
27+
title, *first_names, last_name = ["Mr", "Bond"]
28+
self.assertEqual(__, title)
29+
self.assertEqual(__, first_names)
30+
self.assertEqual(__, last_name)
31+
2632
def test_parallel_assignments_with_sublists(self):
2733
first_name, last_name = [["Willie", "Rae"], "Johnson"]
2834
self.assertEqual(__, first_name)

0 commit comments

Comments
 (0)