from itertools import chain, product
from thechronic.utils import is_iterable

class TheChronic(object):
    def __init__(self, words):
        if is_iterable(words):
            if is_iterable(words[1]):
                # we have an iterable of iterables (ex: a list of lists)
                self._words = list(chain.from_iterable(words))
            else:
                self._words = list(words)
        else:
            raise ValueError('Invalid argument for \'words\'.')

    def combine(self, num_words=1):
        res = product(self._words, repeat=num_words)

        return self._get_words_generator(res)

    def _get_words_generator(self, words):
        for word_parts in words:
            yield ''.join(word_parts)

@@ -116,24 +116,403 @@
 init__(self,
+ words=%5B%5D, files=%5B%5D):%0A        self._parse_words_arg(words)%0A        self._parse_files_arg(files)%0A%0A    def combine(self, num_words=1):%0A        res = product(self._words, repeat=num_words)%0A%0A        return self._get_words_generator(res)%0A%0A    def _get_words_generator(self, words):%0A        for word_parts in words:%0A            yield ''.join(word_parts)%0A%0A    def _parse_words_arg(self,
  words):%0A   
@@ -546,32 +546,51 @@
 %0A            if 
+len(words) %3E 0 and 
 is_iterable(word
@@ -591,17 +591,17 @@
 e(words%5B
-1
+0
 %5D):%0A    
@@ -883,89 +883,73 @@
 def 
-combine(self, num_words=1):%0A        res = product(self._words, repeat=num_words)%0A
+_parse_files_arg(self, files):%0A        if not is_iterable(files):
 %0A   
@@ -957,157 +957,192 @@
     
-return self._get_words_generator(r
+    files = (fil
 es
+,
 )%0A%0A    
-def _get_words_generator(self, words):%0A        for word_parts in words:%0A            yield ''.join(word_parts)
+    for f in files:%0A            with open(f, mode='r') as wfile:%0A                file_words = wfile.read().splitlines()%0A                self._words += file_words
 %0A

implement loading words from files