3 ms·
And while we're at confusion and beginners: at least them = things[:] looks different from them = (list) things; which in C-like languages usually does not
by limmeau 18y ago
And while we're at confusion and beginners: at least
them = things[:]
looks different from
them = (list) things;
which in C-like languages usually does not make a copy of things.
Using slices may avoid fallacies like "I know that int(x) is something like a cast of x to int, so list(x) is like a cast of x to list, which does nothing when x is a list".