mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 05:09:23 +01:00
Made set more in line with the sets that will be released in 2.3
This commit is contained in:
parent
981c21617d
commit
1dc82ec02c
11
src/fix.py
11
src/fix.py
@ -124,8 +124,13 @@ class set(object):
|
|||||||
self.d[x] = None
|
self.d[x] = None
|
||||||
|
|
||||||
def remove(self, x):
|
def remove(self, x):
|
||||||
if x in self.d:
|
del self.d[x]
|
||||||
|
|
||||||
|
def discard(self, x):
|
||||||
|
try:
|
||||||
del self.d[x]
|
del self.d[x]
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class queue(dict):
|
class queue(dict):
|
||||||
@ -249,8 +254,8 @@ def enumerate(L):
|
|||||||
yield (i, L[i])
|
yield (i, L[i])
|
||||||
|
|
||||||
def window(L, size):
|
def window(L, size):
|
||||||
if size <= 0:
|
if size < 1:
|
||||||
raise ValueError, 'sizes <= 0 unallowed.'
|
raise ValueError, 'size <= 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