Does python have the ability to create dynamic keywords?
For example:
qset.filter(min_price__usd__range=(min_price, max_price))
I want to be able to change the usd part based on a selected currency.
Yes, It does. Use **kwargs in a function definition.
**kwargs
Example:
def f(**kwargs): print kwargs.keys() f(a=2, b="b") # -> ['a', 'b'] f(**{'d'+'e': 1}) # -> ['de']
But why do you need that?
2.1m questions
2.1m answers
60 comments
57.0k users