Commit 3aa398b7 authored by Jeroen F.J. Laros's avatar Jeroen F.J. Laros

More pythonic way of working with iterators.

parent 025c0322
from itertools import imap
class iMap(imap):
def __next__(cls):
return cls.next()
map = iMap
......@@ -2,7 +2,7 @@ import sys
if sys.version_info.major < 3:
from .compatibility import map
from itertools import imap as map
def _add(root, word, count):
......@@ -240,7 +240,7 @@ class Trie(object):
def hamming(self, word, distance):
try:
return self.all_hamming(word, distance).__next__()
return next(self.all_hamming(word, distance))
except StopIteration:
return ''
......@@ -273,7 +273,7 @@ class Trie(object):
def levenshtein(self, word, distance):
try:
return self.all_levenshtein(word, distance).__next__()
return next(self.all_levenshtein(word, distance))
except StopIteration:
return ''
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment