From e66566f7b811f75492aadcf2a9fd98db25af5171 Mon Sep 17 00:00:00 2001 From: Bonsai Date: Tue, 24 Aug 2021 13:30:20 +0800 Subject: [PATCH] add deque __bool__ method (#2931) Adds deque.bool --- vm/src/stdlib/collections.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vm/src/stdlib/collections.rs b/vm/src/stdlib/collections.rs index f56d8b02a..272e6ec29 100644 --- a/vm/src/stdlib/collections.rs +++ b/vm/src/stdlib/collections.rs @@ -472,6 +472,11 @@ mod _collections { self.borrow_deque().len() } + #[pymethod(magic)] + fn bool(&self) -> bool { + !self.borrow_deque().is_empty() + } + #[pymethod(magic)] fn iadd( zelf: PyRef,