Ops, the code posted is not quite right (it's in the middle of a rewrite 
:)). Use the following

def inner_iter(L, R):
    if len(L) == 1:
        for i in R:
            yield i * L[0]
    else:
        el = L[0]
        for rest in inner_iter(L[1:], R): 
            for i in R:
                yield rest + i * el
                
def free_mod_iter(module):
    R = module.base_ring()
    L = module.gens()
    return inner_iter(L, R)

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to