List comprehension - NameError: name '_[1]' is not defined ?

mario ruggier mario.ruggier at
Sat Jan 17 18:11:50 CET 2009

Just to add that a further potential subversion possibility could have
been to build the expr in some way from within a template, and then
dynamically setting that string as the source of a new template with
from_string=True. This is precisely the reason why **from within a
template** evoque has never supported the from_string parameter i.e.
you *cannot* "load/create" a template from a string source from within
another template -- you may *only* do that from within the python app.
To illustrate, an extension of the previous example template could
thus become:

$for{expr in [
  ${% evoque("test", src="$${"+expr+"}", from_string=True) %}

That would fail, as it would simply take the value of src i.e. "$
{().__class__.mro()[1].__subclasses__()}" to mean the sub-path to the
template file within the collection (from_string would be simply
interpreted as an evaluation data parameter). See:

More information about the Python-list mailing list