Code: Show/Hide def c_cap(cmd, params, p, targ): <-- notice no arena arena.sd_captainA = p.name |
Code: Show/Hide def cap(arena): arena.sd_captainA = p.name <--notice no p defined either. |
Code: Show/Hide p.arena.sd_captainA = p.name |
Code: Show/Hide 3.3 Mutability Python data structures are either mutable (changeable) or not. Strings are not mutable - once created they cannot be modified in situ (though it is easy to create new, modified versions). Lists are mutable, which means lists can be changed after being created; a particular element of a list may be modified. Either single elements or slices of lists can be modified by assignment: >>> x [1,4,9,'new end of list'] >>> x[2] = 16 >>> x [1,4,16,'new end of list'] >>> x[2:3] = [9,16,25] [1,4,9,16,25,'new end of list'] |
Code: Show/Hide arena.sd_captainA = p.name |