[Python-Dev] type(obj) vs. obj.__class__

Steven D'Aprano steve at pearwood.info
Sun Oct 18 21:57:10 EDT 2015


On Mon, Oct 19, 2015 at 11:41:44AM +1100, Chris Angelico wrote:

> What does this provide that collections.deque(maxlen=size_max)
> doesn't? I'm a little lost.

The Ringbuffer recipe predates deque by quite a few years. These days I 
would consider it only useful in a pedagogical context, giving a 
practical use for changing the class of an object on-the-fly.


-- 
Steve


More information about the Python-Dev mailing list