Skip to content

Commit

Permalink
Fixed many
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAihopGG committed Jun 1, 2024
1 parent a2b25f3 commit 3529adf
Showing 1 changed file with 3 additions and 18 deletions.
21 changes: 3 additions & 18 deletions ufpy/ustack.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ def top(self) -> VT:

def append(self, *items) -> UStack:
"""Append items to stack"""
for item in items:
self.__list.append(item)
return self.__list
self.__list.extend(items)
return UStack(self.__list)

def is_empty(self) -> bool:
return len(self) == 0
Expand All @@ -52,18 +51,4 @@ def __len__(self) -> int:
return len(self.__list)

def __nonzero__(self) -> bool:
return self.is_empty()

# iteration

def __iter__(self) -> UStack:
self.__index = 0
return self

def __next__(self) -> VT:
if self.__index > len(self.__list) - 1:
raise StopIteration
else:
value = self.__list[self.__index]
self.__index += 1
return value
return not self.is_empty()

0 comments on commit 3529adf

Please sign in to comment.