"Steven D'Aprano" <st...@pearwood.info> wrote

import itertools
for x in itertools.product('abc', 'abc', 'abc'):

If you don't like the repeated 'abc' in the call to product(), it can be
written as itertools.product(*['ab']*3) instead.

Nope, I think the repeated string is much clearer, and thus better,
than the cryptogram thanks very much! :-)

But I like the itertools solution.
I really, really, need to spend some time playing with itertools.


--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to