From 613df20d5781640d338111d7ec81ab4a4cbe7a10 Mon Sep 17 00:00:00 2001 From: Maxim Semenyuk <33791308+semenuk@users.noreply.github.com> Date: Sat, 9 Mar 2019 19:45:45 +0500 Subject: [PATCH] Fix '__bool__' method The method returns the truth when the stack is empty --- data_structures/stacks/stack.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data_structures/stacks/stack.py b/data_structures/stacks/stack.py index 66af8c025d8c..7f979d927d08 100644 --- a/data_structures/stacks/stack.py +++ b/data_structures/stacks/stack.py @@ -17,7 +17,7 @@ def __init__(self, limit=10): self.limit = limit def __bool__(self): - return not bool(self.stack) + return bool(self.stack) def __str__(self): return str(self.stack)