Wed, 29 Jul 2020 23:45:53 +0300
begin work on bus compiler
from configparser import ConfigParser profile = ConfigParser() def minmax(data): ''' From: http://code.activestate.com/recipes/577916-fast-minmax-function/ Computes the minimum and maximum values in one-pass using only 1.5*len(data) comparisons ''' import itertools it = iter(data) try: lo = hi = next(it) except StopIteration: raise ValueError('minmax() arg is an empty sequence') for x, y in itertools.zip_longest(it, it, fillvalue = lo): if x > y: x, y = y, x lo = min(x, lo) hi = max(y, hi) return lo, hi