5

I am working with python 3.5 lists on a very performance dependent application.

After searching for object removal in a list of dictionaries I wondered about the colon [:] in that solution. I am aware that it creates a copy (theoretically), but in this example see no purpose for it.

Does it maybe save memory? Or does it have to do with shallow/deep copies? Will python behave differently for the cases of an existing mylist = ... versus mylist[:] = ...?

I've found some similar questions but none with how python behaves given such a assignment.

Akimiya
  • 184
  • 3
  • 10
  • @vaultah Thanks for bringing the [middle duplicate with two answers](https://stackoverflow.com/a/32448477/2202071) to my attention, as it mostly covers my question. I've seen and read the other two, which don't address the main point. – Akimiya Dec 02 '17 at 15:53

0 Answers0