0
a, *_, b = config(

    **{

         k:int(v)

         for k,v in self.request.GET.items()

         if k in self.keys_allowed

      }

)

This is the code exactly as I've been given it. I understand the last two lines, but can't find anything online that matches the format of a, *_, b = config, though I know the stuff inside the brackets is an anonymous function. Speaking of, k:int(v) doesn't even look like Python code. I would greatly appreciate any and all help in this regard. Thank you very much in advance!

  • What is the error. – BrainFl Mar 14 '22 at 14:12
  • 1
    You're looking at (in order): [extended iterable unpacking](https://peps.python.org/pep-3132/), [dict argument unpacking](https://docs.python.org/3/tutorial/controlflow.html#unpacking-argument-lists), and a [dict comprehension](https://www.python.org/dev/peps/pep-0274/). – deceze Mar 14 '22 at 14:15
  • Thank you very much for the links. So am I correct in saying that this code returns a dictionary of integers (`k:int(v)`) using GET.items()? – user14892837 Mar 14 '22 at 15:49
  • It filters `GET` items to only items whose keys are in `self.keys_allowed`, turns all values into ints, then passes them all as keyword arguments to `config`, and keeps the first and last item of `config`'s return. – deceze Mar 14 '22 at 16:01

0 Answers0