Skip to content

Commit

Permalink
Merge pull request #242 from 100cube/about_lists-unpacking
Browse files Browse the repository at this point in the history
Minor addition to list assignments (*splat unpacking with fewer values)
  • Loading branch information
gregmalcolm committed Oct 4, 2021
2 parents 84981e3 + 7ec1357 commit 800cdf5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions koans/about_list_assignments.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ def test_parallel_assignments_with_extra_values(self):
self.assertEqual(__, first_names)
self.assertEqual(__, last_name)

def test_parallel_assignments_with_fewer_values(self):
title, *first_names, last_name = ["Mr", "Bond"]
self.assertEqual(__, title)
self.assertEqual(__, first_names)
self.assertEqual(__, last_name)

def test_parallel_assignments_with_sublists(self):
first_name, last_name = [["Willie", "Rae"], "Johnson"]
self.assertEqual(__, first_name)
Expand Down

0 comments on commit 800cdf5

Please sign in to comment.