On Wed, Oct 23, 2019 at 11:47:04AM +1100, Chris Angelico wrote: > This could be done as an optimization without changing syntax or > semantics.. As long as the initial string is provided as a literal, it > should be possible to call the method at compile time, since (as far > as I know) every string method is a pure function.
Sure, it could be done as an optimization, similar to one of the proposals here: https://bugs.python.org/issue36906 It could also be done by a source code preprocessor, or an AST transformation, without changing syntax. But the advantage of changing the syntax is that it becomes the One Obvious Way, and you know it will be efficient whatever version or implementation of Python you are using. -- Steven _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/ZYJWMGFYDTTCSRND43BUG2LPEQZ4YZTL/ Code of Conduct: http://python.org/psf/codeofconduct/