by RubyPinch · 11y ago · 0 comments
>>> def test(x=1):return lambda:say.say("{x}")
>>> test()
NameError: name 'x' is not defined
https://github.com/syrusakbary/interpy seems like a closer solution, could be modified to also support format specsYour example highlights the binding strategy, but more typical would be:
>>> def test(x=1):
... return fmt("{x}")
...
>>> test()
'1'
>>> test(12)
'12'
>>> test('woobers')
'woobers'