[Python-de] Arrays vorallokieren

Marcus Geiger bwolf-sender-f10e71 at antbear.org
Wed Mar 26 12:20:25 EST 2003


René Liebscher <R.Liebscher at gmx.de> writes:

>> l = [False] * 5
>> m = map(lambda x: [x]*5, l)
>
> Ist das nicht dasselbe wie
>
> m = [[False]*5]*5

nein:
        m = [[False] * 5] * 5
        m[2][1] = 42
        assert(m[2][1] != m[0][1])
        Traceback (most recent call last):
          File "<stdin>", line 1, in ?
          AssertionError

bwolf




More information about the Python-de mailing list