def test3():
    return ','.join(chain(a, repeat(b, 1)))

def test4():
    return ','.join(chain(a, [b]))

def test5():
    return ','.join(y for x in [a, [b]] for y in x)
count = 100
print('test1: %g' % timeit.timeit(test1, number=count))
print('test2: %g' % timeit.timeit(test2, number=count))
print('test3: %g' % timeit.timeit(test3, number=count))
print('test4: %g' % timeit.timeit(test4, number=count))
print('test5: %g' % timeit.timeit(test5, number=count))
Generator expression that resembles the behavior of append