On 10/24/2019 04:03 AM, Steven D'Aprano wrote:
The current "obvious" solution is tedious, annoying, verbose (about a third longer than it need be) and error-prone.^1
--> print("So should we have syntax for sentence literals" ... "so we don't forget spaces, too?")
^1 I'm gratified to see that nobody yet has noticed the error in my earlier example involving the strings 'zero' through 'thirty', which supports my point that the status quo is sub-optimal.
You said it was actual code, so I didn't pay close attention. Does this mean you have now fixed an error in your code? Your welcome. ;-)
^2 On my computer the split idiom is about forty percent slower: $ ./python -m timeit "['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']" 200000 loops, best of 5: 1.44 usec per loop $ ./python -m timeit "'a b c d e f g h'.split()" 100000 loops, best of 5: 2.05 usec per loop so it's not a trivial slowdown, even if this is unlikely to be a bottleneck in many programs.
I hope you're not declaring that a 0.6 usec slowdown on a single import is worth optimizing. -- ~Ethan~ _______________________________________________ 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/VR7TXE6X5Q5NZTOKFRC33FW5ZJGQU6LK/ Code of Conduct: http://python.org/psf/codeofconduct/