Feature or enhancement
Proposal:
Currently the repr output for template strings shows how the data is stored internally, but this is not how the template could be reconstructed via an constructor call and the format is unintuitive since the template parts are not output in the order they appear in the template source. The repr result should output the parts in the order as iterating over the template object does, i.e.
x = 1
y = 2
print(repr(t'{x} + {y}'))
should print
Template(Interpolation(1, 'x', None, ''), ' + ', Interpolation(2, 'y', None, ''))
instead of
Template(strings=('', ' + ', ''), interpolations=(Interpolation(1, 'x', None, ''), Interpolation(2, 'y', None, '')))
This has already been discussed at https://discuss.python.org/t/repr-output-of-t-strings/107653
I'm working on a patch/pull request.
Has this already been discussed elsewhere?
I have already discussed this feature proposal on Discourse
Links to previous discussion of this feature:
https://discuss.python.org/t/repr-output-of-t-strings/107653
Linked PRs
Feature or enhancement
Proposal:
Currently the
reproutput for template strings shows how the data is stored internally, but this is not how the template could be reconstructed via an constructor call and the format is unintuitive since the template parts are not output in the order they appear in the template source. Thereprresult should output the parts in the order as iterating over the template object does, i.e.should print
instead of
This has already been discussed at https://discuss.python.org/t/repr-output-of-t-strings/107653
I'm working on a patch/pull request.
Has this already been discussed elsewhere?
I have already discussed this feature proposal on Discourse
Links to previous discussion of this feature:
https://discuss.python.org/t/repr-output-of-t-strings/107653
Linked PRs