testutil.py 319 Bytes
Newer Older
1
2
3
# -----------------------------------------------------------------------------
# Utils

4
5
6
def eq(x):
    return lambda y,z=x: y == z

7
8
9
10
def append(x,y):
    return x + y

def concat(xs):
krc's avatar
krc committed
11
    return reduce(append,xs,[])
12
13
14
15
16
17
18

def chop(s):
    if s[len(s)-1:] == '\n':
        return s[:len(s)-1]
    else:
        return s