Exemple #1
0
def test_seq():
    print "... test sequence unicity"
    print ". simple"
    l = range(10) * 2
    shuffle(l)
    print l
    print Struct.seqUnique(l)
    print ". list(list)"
    l = list()
    for _ in range(3):
        v = range(randint(1, 4))
        l.append(v)
        v = list(v)
        l.append(v)
    shuffle(l)
    print l
    print Struct.seqUnique(l)
    print ". list(dict)"
    l = list()
    for _ in range(3):
        v = range(randint(1, 4))
        v = dict(('id' + str(k), k) for k in v)
        l.append(v)
        v = dict(v)
        l.append(v)
    shuffle(l)
    print l
    print Struct.seqUnique(l)
Exemple #2
0
def main():
    lst = ["plop.common.plop.string",
           "plop.common.plop.blah",
           "plop.common.plop"]

    print Struct.commonPrefix(tok.split('.') for tok in lst)
Exemple #3
0
def size_lambda():
    d = dict()
    gen_dict(d, 5)

    print Struct.sizeOf(d)