Question: I have an app in which the main view is a `PopupWindow` with a couple of `ImageViews` and an `EditText` on top of them. My problem is when I enter a very long text and the text box expands down and pushing the image views out of the view and I can't see them, and in order to see them back I need to delete some text.

What is the proper way of overcoming this?

thanks.

Answer: 
```
>>> list1 = [1,2,3,4,5]
>>> list2 = list1

```

**To get a better understanding, let us see with the help of pictures what happens internally.** 

```
>>> list1 = [1,2,3,4,5]

```

This creates a list object and assigns it to `list1`.
![Initialization of list1 in memory](https://i.stack.imgur.com/zkQ8F.png) 

```
>>> list2 = list1

```

The list object which `list1` was referring to is also assigned to `list2`.
![](https://i.stack.imgur.com/IM5Ra.png) 

Now, lets look at the methods to empty an list and what actually happens internally. 

**METHOD-1: Set to empty list [] :** 

```
>>> list1 = []
>>> list2
[1,2,3,4,5]

```

![Set list1 to empty list](https://i.stack.imgur.com/FQWAL.png)

This does not delete the elements of the list but deletes the reference to the list. So, `list1` now points to an empty list but all other references will have access to that old `list1`.  

This method just creates a new list object and assigns it to `list1`. Any other references will remain.

**METHOD-2: Delete using slice operator[:] :**

```
>>> del list1[:]
>>> list2
[]

```

![Delete all elements of list1 using slice operator](https://i.stack.imgur.com/qSgVB.png)

When we use the slice operator to delete all the elements of the list, then all the places where it is referenced, it becomes an empty list. So `list2` also becomes an empty list.
Well, del uses just a little less space in the computer as the person above me implied. The computer still accepts the variable as the same code, except with a different value. However, when you variable is assigned something else, the computer assigns a completely different code ID to it in order to account for the change in memory required.