This can then also be called (using the built-in double-star-unpacking feature) as:
mock(obj, **{'x': 1, 'y': 2})
or even
mock(obj, **dict([('x', 1), ('y', 2)]))
Then there’s no explicit need to support multiple alternative function signatures, and in particular you don’t get people using the (quite atypical and therefore semantically ambiguous):
Comments
At risk of bikeshedding, I think the "most pythonic" approach would be mock(obj, x=1, y=2)
Seriously though, cool lib, thanks for it =)
Yes, the most pythonic is:
Which you get by: This can then also be called (using the built-in double-star-unpacking feature) as: or even Then there’s no explicit need to support multiple alternative function signatures, and in particular you don’t get people using the (quite atypical and therefore semantically ambiguous):Thanks, updated the code to use keyword arguments only.