osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Need to pass a class instance to a gettext fallback


Josef Meile wrote:

> language = kwargs['language']
> del kwargs['language']

Not really important, but there's a method for that:

language = kwargs.pop("language")

>   def __init__(self, *args, **kwargs):
>     language = kwargs['language']
>     del kwargs['language']

In Python 3 this can also be spelt with a keyword-only language argument:

def __init__(self, *args, language, **kwargs):
    ...  # no pop() or del