note that we can use the rotate and pop methods to delete selected elements also worth knowing is simple way to return slice of dequeas listwhich can be done as followsthe itertools islice method works in the same way that slice works on listexcept rather than taking list for an argumentit takes an iterable and returns selected valuesby start and stop indicesas list useful feature of deques is that they support maxlen optional parameter that restricts the size of the deque this makes it ideally suited to data structure known as circular buffer this is fixed-size structure that is effectively connected end to end and they are typically used for buffering data streams the following is basic exampledq =deque([],maxlen= for in range( )dq append(iprint(dq this prints out the followingin this examplewe are populating from the right and consuming from the left notice that once the buffer is fullthe oldest values are consumed firstand values are replaced from the right we will look at circular buffers again in lists and pointer structuresby implementing circular lists