On Aug 24, 2015, at 10:23 PM, Ron Adam
wrote: On 08/24/2015 06:45 PM, Mike Miller wrote:
- How problematic will it be that an e-string pins all the interpolated objects in memory for its lifetime?
It will be an object holding a raw template string, and a number of variables. In normal usage I don't suspect it to be a problem.
If an objects __str__ method could have an optional fmt='spec' argument, then an estring, could just hold strings, and not the object references. That also prevent surprises if the object is mutated between the time it's estring is created and when the estring is used as a string. For that matter it prevents an estring from printing one way at one time, and another at another time.
I don't know if the fomatting can be split like this... Where an object is formatted to a string representation, and then that is formatted to a field specification. The later being things like width, fill, right, center, and left. These are independent of the object and belong to the string. Things like nubmer of places and sign or to use leading or trailing zeros is part of the object being converted to a string.
It's not possible. For examples, look at all of the number format options. How would you implement hex conversions? Or datetime %A? Eric.