This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients
Date 2004-10-18.04:34:45
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
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.
History
Date User Action Args
2007-08-23 14:26:46adminlinkissue1048870 messages
2007-08-23 14:26:46admincreate