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.
Hmmm. Hard to say. Did some microbenchmark tests, and sometimes the bitwise operation is faster, and sometimes the old fashioned exponential computation is faster. And I simulated very many trials with a wide range of powers, so I doubt there is any benefit to using the bitwise operation.
Other than being fun-spritied, I wouldn't really dub this a very readable code, since not many people know the bitwise operator in Python.
I actually never knew this. This is about 25% faster than the traditional method of 2 ** 5. Going to treasure this nugget of knowledge forever.
Not faster in Python. This is just C heritage.
Wow, this is really clever! For those that don't get it, this is exactly the same as 2**len(list) but is much faster because its doing bitwise operations.
Basically, 1<<len(list) means you take the bit representing 1: 00000001 and move that one down the byte len(list) bits. so a set with length 5 would push the bit over 5 to be 00100000 == 32 == 2^5.
Brilliant.