pg.symbolic.as_functor

Accessible via pg.symbolic.as_functor.

as_functor(func, ignore_extra_args=False)[source]

Make a functor object from a regular python function.

NOTE(daiyip): This method is designed to create on-the-go functor object, usually for lambdas. To create a reusable functor class, please use functor_class method.

Return type:

pg.Functor

Parameters:
  • func – A regular python function.

  • ignore_extra_args – If True, extra argument which is not acceptable by func will be ignored.

Returns:

Functor object from input function.