I have the following code
pop = [[2.162840682206156, 1.8735137437504137, 1.0432493688065905],
[2.8316083260339413, 1.3335260337446606, 0.7503595302921512]]
print '==>pop :: {}'.format(pop)
def serial(ind):
ssgs = ssgs.SSGS()
pheno = ssgs.s_SGS(ind)
print "serial :: {}".format(pheno.serial)
return pheno.serial,
for i in range(len(pop)):
print '==>pop1 :: {}'.format(pop[i])
value = serial(pop[i])
print '==>pop2 :: {}'.format(pop[i])
after passing the list pop to the serial() the value of pop becomes None,
==>pop :: [[2.162840682206156, 1.8735137437504137, 1.0432493688065905], [2.8316083260339413, 1.3335260337446606, 0.7503595302921512]]
==>pop1 :: [2.162840682206156, 1.8735137437504137, 1.0432493688065905]
serial :: [0, 0, 3]
==>pop2 :: [None, None, None]
==>pop1 :: [2.8316083260339413, 1.3335260337446606, 0.7503595302921512]
serial :: [0, 0, 3]
==>pop2 :: [None, None, None]
Update: The output that I am expecting is somthing like this i.e. the value of pop should not change
==>pop1 :: [2.8316083260339413, 1.3335260337446606, 0.7503595302921512]
serial :: [0, 0, 3]
==>pop2 :: [2.8316083260339413, 1.3335260337446606, 0.7503595302921512]
update: ssgs is a job scheduling class where it finds the start time of each task.
If I am correct a copy of pop is sent to the serial(), then why the values of pop is replaced by None? Why the program behaves this way?