AOL: Video: This Pit Bull Will Be on Santa’s ‘Naughty List’ This Year Video: This Pit Bull Will Be on Santa’s ‘Naughty List’ This Year The first, [:], is creating a slice (normally often used for getting just part of a list), which happens to contain the entire list, and thus is effectively a copy of the list. The second, list(), is using the actual list type constructor to create a new list which has contents equal to the first list. When reading, list is a reference to the original list, and list[:] shallow-copies the list.

Understanding the Context

When assigning, list (re)binds the name and list[:] slice-assigns, replacing what was previously in the list. Also, don't use list as a name since it shadows the built-in. I have a piece of code here that is supposed to return the least common element in a list of elements, ordered by commonality: def getSingle(arr): from collections import Counter c = Counte... Is there a way in Python to list all installed packages and their versions?

Key Insights

I know I can go inside python/Lib/site-packages and see what files and directories exist, but I find this very awkward. ... By using a : colon in the list index, you are asking for a slice, which is always another list. In Python you can assign values to both an individual item in a list, and to a slice of the list. What is the difference between list [1] and list [1:] in Python?

Final Thoughts