The klipse plugin can also features python interactive snippets - using skulpt - http://www.skulpt.org/.
Take a look here: http://blog.klipse.tech/klipse/2016/09/09/klipse-languages.h...
But unfortunately, itertools is not (yet?) supported by skulpt :(