I'm not sure if anyone has mentioned it on this thread, but with respect to
your comment about adding either on.empty or a decorator, the Django template
syntax uses
{% for x in iterator %}
{{ x }}
{% empty %}
Empty
{% endfor %}
and this seems to work quite well and be incredibly intuitive, a
Something like this?itertools.product(x or ("",) for x in perm_elems)Out of
curiousity, how might one adapt this if x is not a list but an iterator,
without doing `itertools.product(list(x) or ("",) for x in perm_elems)`?
On Wed, 02 Mar 2022 09:25:42 -0600 antoon.par...@vub.be wrote
I sent this 17hrs ago but I guess it just went through. Apologies for the
redundant comments... On Tue, 01 Mar 2022 18:57:02 -0600
om+pyt...@omajoshi.com wrote For completeness, the itertools solution
(which returns an iterator) is
>>> os = ["Linux","Windows"]
>>> region = ["us-east-
For completeness, the itertools solution (which returns an iterator) is
>>> os = ["Linux","Windows"]
>>> region = ["us-east-1", "us-east-2"]
>>> import itertools
>>> itertools.product(os,region)
>>> list(itertools.product(os,region))
[('Linux', 'us-east-1'), ('Linux', 'us-east-2'), ('Windows', 'u