Question: I am trying to use a method from the deque library (from collections). But I get the error "MyQueue instance has no attribute 'append'". But I'm sure that deque has an "append" method. What is causing this error?

```
import copy
from collections import deque

class MyQueue:
    def __init__(self):
        self = deque()
    def push(self, val):
        self.append(val)

```

Answer: 
You can also do this by wrapping a `deque` instance with your `MyQueue`:

```
from collections import deque

class MyQueue(object):
    def __init__(self, *args, **kwargs):
        self._queue = deque(*args, **kwargs)

    def push(self, value):
        self._queue.append(value)

    def pop(self):
        return self._queue.pop()

```

This would be a good approach if you want to use the `deque` internally but are interested in providing a simplified interface compared to what `deque` already provides.
You can do this by subclassing `deque`:

```
from collections import deque

class MyQueue(deque):
    def push(self, val):
        self.append(val)

```

which could then be used like this:

```
>>> q = MyQueue()
>>> q.push(5)
>>> q
deque([5])

```

For more information about classes and inheritance in Python, see the [Python tutorial](https://docs.python.org/2/tutorial/classes.html).