Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 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