Skip to content

Inspect

Bases: Protocol


              flowchart TD
              pyochain.rs.Inspect[Inspect]

              

              click pyochain.rs.Inspect href "" "pyochain.rs.Inspect"
            

Mixin class providing the inspect method.

inspect(func, *args, **kwargs)

Pass Self to func to perform side effects without altering the data.

This method is very useful for debugging or passing the instance to other functions for side effects, without breaking the fluent method chaining.

Parameters:

Name Type Description Default
func Callable[Concatenate[Self, P], object]

Function to apply to the instance for side effects.

required
*args P.args

Positional arguments to pass to func.

()
**kwargs P.kwargs

Keyword arguments to pass to func.

{}

Returns:

Name Type Description
Self Self

The instance itself, unchanged.

Example
>>> from pyochain import Seq
>>> Seq((1, 2, 3, 4)).inspect(print).last()
Seq(1, 2, 3, 4)
4