Skip to content

Commit

Permalink
Changed a minor thing
Browse files Browse the repository at this point in the history
  • Loading branch information
nbro committed Jan 24, 2017
1 parent c64e712 commit 5546f32
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ands/ds/Queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,15 @@ def __init__(self, ls=None):
if ls is not None:
if not isinstance(ls, Iterable):
raise TypeError("ls must be an iterable object")
if not all(elem is not None for elem in ls):
if any(elem is None for elem in ls):
raise ValueError("all elements of ls must be not None")
else:
ls = []
self._q = deque(ls)

def enqueue(self, elem) -> None:
"""Adds `elem` to the end of this queue."""
"""Adds `elem` to the end of this queue.
If `elem` is None, ValueError is raised."""
if elem is None:
raise ValueError("elem cannot be None")
self._q.append(elem)
Expand Down

0 comments on commit 5546f32

Please sign in to comment.