29.03.18 13:17, Jeff Allen пише: > '{1} {0}'.format(a(), b()) # E1 > > f'{b()}{a()}' # E2 > > > I think I would be very surprised to find b called before a in E1 > because of the general contract on the meaning of method calls. I'm > assuming that's what an AST-based optimisation would do? There's no > reason in E2 to call them in any other order than b then a and the > documentation tells me they are. I was going to optimize only formatting with implicit references. '{} {}' but not '{1} {0}' and either not '{0} {1}'. This guaranties in-order computation and referencing every subexpression only once. I don't have a goal of converting every string formatting, but only the most common and the most simple ones. If go further, we will need to add several new AST nodes (like for comprehensions).
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4