Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
That's a twoliner though.
wow made a functionnal oneliner that actually is pythonic... yay
I love kmaps
You know what, that's actually a good point. In some cases you can be reasonably confident that the method you're writing will only concatenate a small number of strings or will not be run a huge number of times, so the difference in performance is going to be insignificant.
I should probably have phrased my initial response differently, along the lines of "yo, concatenating is ok in small doses, but .join() is a lot faster if you are gonna do that with a lot of strings; it also makes you look good on job interviews". Unfortunately, don't think I can edit it.
Cheers :)
Yes, string addition is slower than joining a list. But it's only significant if you are adding a lot of strings together.
Here's a nice article about this problem when the number of strings to be added are small The Sad Tragedy of Micro-Optimization Theater
When adding 2 or 3 strings together, it has no performance overhead whatsover compared to making a list and joining it.
And since this method is much more clear and pythonic, it is best practice.
Unfortunately this is NOT a 'best practice'. String concatenation using + operator is some 30 times slower than using "separator".join(iterator_to_be_joined).
For additional reading: https://waymoot.org/home/python_string/