I love how beautiful python looks/feels and I\'m hoping this can be cleaner (readability is awesome).
What\'s a clean way to accept an optional keyword argument when
I usually just do essentially what you're doing here. However, you can shorten/clean up your code by supplying a default argument to dict.pop
:
def __init__(self, *args, **kwargs):
user = kwargs.pop('user', None)
super(BaseCheckoutForm, self).__init__(*args, **kwargs)
if user is not None:
self.prefill_from_user(user)