[stringtemplate-interest] Bug in PyST 3.1: $x.(y)$ when y=0

Roman Odaisky roma at qwertty.com
Tue Nov 11 03:53:32 PST 2008


Hi,

>>> st = StringTemplate("$x.(y)$")
>>> st["x"] = { "0": "zero", "1": "one" }
>>> st["y"] = 1
>>> print unicode(st)
one
>>> st = StringTemplate("$x.(y)$")
>>> st["x"] = { "0": "zero", "1": "one" }
>>> st["y"] = 0
>>> print unicode(st)

>>>

Expected: “zero”.

Maybe it’s an “if something:” in a place where “if something is not None:” 
should have been used. The documentation is explicit in treating only "" and 
None as null values.

P. S. Any chance of a final PyST 3.2?

-- 
WBR
Roman
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2286 bytes
Desc: not available
Url : http://www.antlr.org:8080/pipermail/stringtemplate-interest/attachments/20081111/3b300a71/attachment.bin 


More information about the stringtemplate-interest mailing list