may be a dumb question,but I can't understand why?

luckey trytop at 21cn.com
Wed Nov 7 06:26:58 CET 2001


the following function is in bpnn.py
def makeMatrix(I, J, fill=0.0):
    m = []
    for i in xrange(I):
        m.append([fill]*J)
    return m

I rewrite it to :
def makeMatrix(I, J, fill=0.0):
    m=[[fill]*J]*I
    return m
the result is defference
Can someone tell me the defference between the two function?








More information about the Python-list mailing list