[Python-ideas] Improving fn(arg=arg, name=name, wibble=wibble) code

Anders Hovmöller boxed at killingar.net
Sat Sep 8 16:01:36 EDT 2018



>    get_permissions(item, request, obj)
> 
> and then simply write
> 
>    ** get_permissions(item, request, obj)
> 
> in the function call, to pass the permissions to the called function.
> By the way, for ease of use this is relying on
> 
>    https://www.python.org/dev/peps/pep-0448/ # Additional Unpacking
> Generalizations
> 
> which allows multiple **kwargs in a function call. It was implemented
> in Python 3.5.
> 
> By the way, Django 1.11 and 2.0 are still supported by Django, and
> they both support Python 3.4. So we'll have to wait for a bit before
> Django could accept this suggestion.

A dict merge is fairly trivial to implement to get even 2.7 support so no need to be that restrictive.

This is a good fix for this case. 


More information about the Python-ideas mailing list