A TT2 curiosity: pop does what it always does—but when I have template code embedded in HTML, it also inserts the popped value into my HTML, causing it to be displayed on screen. For example,
[% list = [1, 2, 3] %]
[% list.pop %]
removes "3" from the list and inserts it into my HTML. I don't want it to insert anything into my HTML. I just want the list to contain one less value. I see a lot of ways to do this, e.g.,
[% list = [1, 2, 3] %]
[% p = list.pop %]
but I don't like any of them. The example I've provided is unsatisfactory because I've no use for the popped value. I would use something like
[% list = [1, 2, 3] %]
[% list = list.slice(0,1) %]
but I won't always know the length of the list in advance. Isn't there a simple standard way to do what I want?
Many thanks. I searched the TT mailing list but couldn't find anything speaking to this.
|