mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-24 11:42:52 +01:00
Made catch return and fixed __repr__ of queue.
This commit is contained in:
parent
a5fc83ef63
commit
f682f639c5
@ -44,7 +44,7 @@ def ignore(*args, **kwargs):
|
|||||||
|
|
||||||
def catch(f, *args, **kwargs):
|
def catch(f, *args, **kwargs):
|
||||||
try:
|
try:
|
||||||
f(*args, **kwargs)
|
return f(*args, **kwargs)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -175,7 +175,7 @@ class queue(dict):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return 'queue(%s)' % ', '.join(map(str, self))
|
return 'queue(%s)' % ', '.join(map(repr, self.itervalues()))
|
||||||
|
|
||||||
|
|
||||||
class IterableMap(object):
|
class IterableMap(object):
|
||||||
@ -249,6 +249,8 @@ def enumerate(L):
|
|||||||
yield (i, L[i])
|
yield (i, L[i])
|
||||||
|
|
||||||
def window(L, size):
|
def window(L, size):
|
||||||
|
if size <= 0:
|
||||||
|
raise ValueError, 'sizes <= 0 unallowed.'
|
||||||
for i in xrange(len(L) - (size-1)):
|
for i in xrange(len(L) - (size-1)):
|
||||||
yield L[i:i+size]
|
yield L[i:i+size]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user