2 ms·
disagree. it only allows Python expressions in the same context in which they are already allowed: in the code. it's not possible to create an f-string at runti
by baq 11y ago
disagree. it only allows Python expressions in the same context in which they are already allowed: in the code. it's not possible to create an f-string at runtime.
- asgard1024 11y agoSecurity was not my primary concern, but even if the design can be made secure, it is still a concern (because bugs happen). In any case, you just stated another counter argument - it breaks orthogonality of the language (string being interpolated must be a literal), just to make one assignment not explicit. Maybe it is popular in other languages - their call, but the fact is, it goes quite wildly against Python design philosophy. I would also like to note that the are templating systems that let you evaluate arbitrary Python expressions. Perhaps these would be a better choice for users who feel need for this proposal.
- baq 11y agoi agree that there are multiple templating solutions, but i disagree that they fill the same niche. this is a language usability (UX even) thing, not a purity thing. the fact is people do '...'.format(locals()) for the same purpose (or '...' % locals()), which is strictly worse and may not even work on some python implementations. i also disagree that this feature goes against the zen of python: practicality beats purity, after all.