I'm currently learning Python for work and I learnt about the spread operator. Coming form Javascript and using ES6, I figured that creating a list from an object would work in a similar fashion using the spread operator. Turns out, it does.
I asked a colleague who is proficient in Python what the best way to do it was using the following example:
my_string = 'this is a string'
my_list_option_one = list(my_string)
my_list_option_two = [*my_string]
Both options create the same output. He told me that the first is correct because the second is weird and no one would do that.
Later I learnt about timeit and decided to give both options a try to see which was faster. Surprisingly, the one that's not done is faster as per the screen grab below:
So why is it faster and why is it not used?