[Python-Dev] Re: Update PEP 292
Barry Warsaw
barry at python.org
Fri Aug 20 00:36:42 CEST 2004
On Thu, 2004-08-12 at 02:05, Andrew Durdin wrote:
> One thing the PEP doesn't make clear: do these templates only
> interpolate string variables, or will they handle anything with a
> __str__ method?
>
> e.g., will the following raise an exception:
>
> print Template("I am ${height} centimetres tall.") % {height: 183}
In the current implementation, this will raise an exception. I'm
uncomfortable with automatic stringification (hey, create your own dict
subclass for the mapping if you want ;) -- but I've included this as an
open issue in the next rev of the PEP.
-Barry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 307 bytes
Desc: This is a digitally signed message part
Url : http://mail.python.org/pipermail/python-dev/attachments/20040819/5ac2e1f7/attachment.pgp
More information about the Python-Dev
mailing list