
On Thu, Oct 24, 2019 at 4:22 AM Andrew Barnert via Python-ideas <python-ideas@python.org> wrote:
On Oct 23, 2019, at 10:04, Christopher Barker <pythonchb@gmail.com> wrote:
This talk about optimization is confusing me:
The main argument for why “a b c”.split() is not good enough, and therefore we need a new syntax, is that it’s “too slow”.
Someone earlier in this thread said we could optimize calling split on a string literal, just as we can and do optimize iterating over a list literal in a for statement.
I was the one to post it in this thread, but it wasn't my invention - talk of optimizing method calls on literals has been around before.
I agree. That’s why I think “too slow” isn’t a good argument, and to the tiny extent that it is, “then let’s write an optimizer for the already-common idiom” is a good answer, not “let’s come up with a whole new syntax that does the same thing”.
Agreed. The value of creating new syntax is (must be) that it better expresses programmer intent, not that it's easier to optimize. ChrisA