Slackbot
12/01/2022, 12:30 PMElijah Ben Izzy
12/01/2022, 3:38 PMextract_fields
tool that will help you out
Following code from memory -- will run soon to ensure that it works perfectly.
(2) is my favorite -- would look like this:
@function_modifiers.extract_fields('d', 'e')
def d_and_e(a: int, b: int, c: int) -> dict:
return {'d': a+c, 'e' : b+c}
Currently we don't have an extract_items for tuples but that would be reasonable (and we're looking for contributions).
For (1) you'd do something like this:
def d_and_e(a: int, b: int, c: int) -> tuple:
return (a+c, b+c)
def d(d_and_e: tuple) ->int:
return d_and_e[0]
def e(d_and_e: tuple) ->int:
return d_and_e[1]
Which is IMO a little uglier.