---------------------------------------------------------------------- This is the API documentation for the placeholder library. ---------------------------------------------------------------------- ## Classes F Partial function with operator support. Builds partially-bound callables via operator overloading. In a binary expression, the other operand is bound and a callable is returned. The module singleton `_` is an instance of this class. Supported Operators ------------------- All applicable double-underscore methods are supported, including arithmetic (`+`, `-`, `*`, `/`, `//`, `%`, `**`, `@`), bitwise (`&`, `|`, `^`, `<<`, `>>`), unary (`-`, `+`, `~`, `abs`, `round`, `trunc`, `floor`, `ceil`, `reversed`), and comparison (`==`, `!=`, `<`, `>`, `<=`, `>=`). Unsupported Operators ------------------- `len`, `bool`, and `in` coerce the output type. M() Creates method callers and multi-valued getters. The module singleton `m` is an instance of this class. ---------------------------------------------------------------------- This is the User Guide documentation for the package. ---------------------------------------------------------------------- ## `F` and `_` (singleton) ```{python} from placeholder import _ _.real ``` ```{python} nums = (0 + 2j), (1 + 1j), (2 + 0j) min(nums, key=_.real) ``` ```{python} min(nums, key=_.imag) ``` ```{python} _[0] ``` ```{python} pairs = "ac", "bb", "ca" min(pairs, key=_[0]) ``` ```{python} min(pairs, key=_[-1]) ``` ```{python} import itertools list(itertools.accumulate(range(1, 6), _ * _)) ``` ```{python} list(itertools.filterfalse(_ % 2, range(10))) ``` ```{python} list(filter(_ % 2 == 0, range(10))) ``` ```{python} list(filter(abs(_) < 1, [-1, 0, 1])) ``` ## `M` and `m` (singleton) Support for `attrgetter(*)`, `itemgetter(*)`, and `methodcaller`. ```{python} from placeholder import m m("real", "imag") ``` ```{python} m[0, -1] ``` ```{python} m.split("-") ```