I was wondering if anybody had any ideas on how to easily alias a method (without creating another method) but pass a static argument too? An example (from how we would normally alias the object - but it obviously doesn't work) to demonstrate what I mean.
# Short and to the point
# Normal: alias = method
alias = method("static", arguments)
from functools import partial
alias = partial(method, 'static')
or, slower but without imports:
alias = lambda *args, **kwargs: method('static', *args, **kwargs)
partial is for exactly this purpose; the lambda method is a little more flexible if you need to interleave predefined and changing arguments.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With