Cope 2.5.0
My personal "standard library" of all the generally useful code I've written for various projects over the years
Loading...
Searching...
No Matches

◆ closest()

int Cope.misc.closest ( SupportsInt  target,
Iterable[SupportsInt]  compare,
  index = False 
)

Finds the value in compare that is closest to target.

Returns the index (if index is True), or the value. Uses the - operator. If there are multiple closest values in the list, it returns the first one

Definition at line 51 of file misc.py.