Handle named parameters in 3.0..3.3 lambdas

What a pain. Thank you, Python!
This commit is contained in:
rocky
2019-12-17 09:28:48 -05:00
parent aa398423a3
commit 01b2b46757
6 changed files with 46 additions and 21 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -3,6 +3,7 @@
# Bug is handling default value after * argument in a lambda.
# That's a mouthful of desciption; I am not sure if the really
# hacky fix to the code is even correct.
#
# FIXME: try and test with more than one default argument.
@@ -14,4 +15,4 @@ packs = {w: (lambda *data, width=w: pack(width, data)) for w in (1, 2, 4)}
assert packs[1]('a') == (1, ('a',))
assert packs[2]('b') == (2, ('b',))
assert packs[4]('b') == (4, ('c',))
assert packs[4]('c') == (4, ('c',))