tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 deletions
15
Task/Queue-Definition/Python/queue-definition-2.py
Normal file
15
Task/Queue-Definition/Python/queue-definition-2.py
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
class FIFO: ## NOT a new-style class, must not derive from "object"
|
||||
def __init__(self,*args):
|
||||
self.contents = list(args)
|
||||
def __call__(self):
|
||||
return self.pop()
|
||||
def empty(self):
|
||||
return bool(self.contents)
|
||||
def pop(self):
|
||||
return self.contents.pop(0)
|
||||
def __getattr__(self, attr):
|
||||
return getattr(self.contents,attr)
|
||||
def next(self):
|
||||
if not self:
|
||||
raise StopIteration
|
||||
return self.pop()
|
||||
Loading…
Add table
Add a link
Reference in a new issue