Hola, > def word_sequences(words, step=1): > step = max(step, 1) > i = 0 > while i < len(words) - step: > yield (words[i], words[i+step]) > i += 1
Esto no es idiomático,
qué tal:
def words(seq, distance):
for i in xrange(len(seq) - distance):
yield seq[i], seq[i + distance]
--
Reynaldo
_______________________________________________
Python-es mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-es
FAQ: http://python-es-faq.wikidot.com/
