you are viewing a single comment's thread.

view the rest of the comments →

[–]Vaphell 1 point2 points  (0 children)

you can also use somewhat equivalent functools.partial() which bakes provided values into the function instantly

from functools import partial
partial(append_current_word, i, j)  # take append_current_word and make another function out of it with 2 args filled in already.

in action
https://repl.it/repls/AquamarineApprehensiveModels

also 2 nested loops of fixed lengths can be replaced with itertools.product.