updated contents from Atlas repo
This commit is contained in:
19
interfaces/tombolist.py
Normal file
19
interfaces/tombolist.py
Normal file
@@ -0,0 +1,19 @@
|
||||
from random import randrange
|
||||
|
||||
from tombola import Tombola
|
||||
|
||||
|
||||
class TomboList(list): # <1>
|
||||
|
||||
def pop(self):
|
||||
if self: # <2>
|
||||
return super().pop(randrange(len(self))) # <3>
|
||||
else:
|
||||
raise LookupError('pop from empty TomboList')
|
||||
|
||||
def load(self, iterable): self.extend(iterable) # <4>
|
||||
|
||||
def loaded(self): return bool(self) # <5>
|
||||
|
||||
|
||||
Tombola.register(TomboList) # <6>
|
||||
Reference in New Issue
Block a user