On 29 November 2013 11:13, Stephen J. Turnbull <stephen@xemacs.org> wrote:
Although AFAIK attribute access and filter syntax are common features of popular templating languages, I don't think it's a good idea for Python to advocate a particular set of features in its format language when the set of commonly accepted features is quite restricted (eg, one level of object attribute access), so in practice templating languages are not going to go away. On the Python side, Python cannot assume that the output language will be a structured markup language with styling features; the low-level formatting syntax is still needed.
-1 on adding more templating features to Python's stdlib; .format() already hits the sweet spot given current best practice IMO.
As is frequently the case, Anatoly has failed to do his research on what is already possible and the rationale for the status quo before proposing changes. This is in spite of repeated requests (over a number of years) that he stop wasting people's time on the core development lists. 1. The string.Template syntax is aimed at document translators and other non-developer string formatting use cases. It is not really intended for programmatic use. This is covered explicitly in PEP 292 (which added string.Template) 2. The str.format mini-language *is* designed for programmatic use, and already offers attribute and item access as part of element substitution (see PEP 3101 and the standard library documentation). There's essentially zero chance of a fourth approach to string formatting being added to the standard library - third party libraries remain free to do whatever they want, though. Regards, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia