Terry J. Reedy <tjre...@udel.edu> added the comment:
This appears to be an incomplete breadth-first search program. (Incomplete: the visited list, for instance, is initialized and appended, but never used.) checkvisit consists of multiple references to the path list. Each time path is appended, it is then cleared and repopulated (with the same sequence). Given this and the location of the print statement, the output function output looks correct. Each time checkvisit is printed, it prints the current value of path k times, where k increases each iteration. Alan, the problem appears to be that you misunderstand lists and lists of lists and especially lists containing the same list multiple times. Do some simpler experiments and if you are still puzzled, post on python-list, not here. ---------- nosy: +terry.reedy _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue34991> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com