Message22740
Logged In: YES
user_id=80475
Closing as invalid -- this is a bug in the OP's script, not
in Python itself.
The error is obious when the code is simplified further by
in-lining the function. Also, it helps to explicitly set
the initial values of variables between the two sections:
#!/usr/bin/env python
num_elem = 100
key_src = range(num_elem+1)
keynums1 = key_src[:]
assert key_src[-1] == 100
for _ in xrange(num_elem):
keynums1[key_src.pop()]
keynums2 = [0]
for _ in xrange(102):
key_src[keynums2.pop()]
I think your coding error was in assuming that keynum2 held
a different value before the second half was run. If so,
that could have been found by using pdb or by inserting
print statements to reveal what is going on.
|
|
Date |
User |
Action |
Args |
2007-08-23 14:26:46 | admin | link | issue1048870 messages |
2007-08-23 14:26:46 | admin | create | |
|