code explanation

Terry Reedy tjreedy at udel.edu
Mon Jan 14 23:48:02 EST 2013


On 1/14/2013 11:00 PM, Rodrick Brown wrote:
> Can someone explain what's going on here.
>
> def _build_magic_dispatcher(method):
>      def inner(self, *args, **kwargs):
>          return self.__dict__[method](*args, **kwargs)
>      inner.__name__ = method
>      return inner

Nothing, until you run that with some particular version of Python. If 
you do run it, the result should be as documented for that particular 
version. If you write additional code to call the function, the result 
will depend on the Python version and argument.

Now, what did you actually want to know ;-?
You should likely find the answer in the reference manual, especially 
the section on def statements.

-- 
Terry Jan Reedy




More information about the Python-list mailing list