Spencer Brown <spencer...@live.com> added the comment:
This is intentional behaviour, you actually created an infinite loop. When you iterate over a list, all Python does is track the current index through the list internally, incrementing it each time. But each iteration, you call list.append() to add a new item to the end of the list, so you're continually making it longer and preventing the iteration from ending. Regardless of that, this probably isn't a good use of list comprehensions anyway - append() always returns None, so the result of this comprehension would be a useless list of Nones. It'd be better to just use a regular for loop, or if you're just wanting to copy the list call list.copy() or list(your_list). ---------- nosy: +Spencer Brown _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue45579> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com