def test1():
l = []
for i in range(1000):
l = l + [i]
def test2():
l = []
for i in range(1000):
l.append(i)
def test3():
l = [i for i in range(1000)]
def test4():
l = list(range(1000))
t1 = Timer("test1()", "from __main__ import test1")
print("concat ", t1.timeit(number=1000), "milliseconds")
t2 ... t4 = ...
---output---
concat 6.54352807999 milliseconds
append 0.306292057037 milliseconds
comprehension 0.147661924362 milliseconds
list range 0.0655000209808 milliseconds
Note how much quicker list comprehension is in python. I knew this was powerful, but I had mostly been using it out of convenience before. But more importantly, I know to append instead of concatenate whenever possible.
There’s a weird bug where copying any files to the WSL directory causes files to duplicate with an .Zone.Identifier
extension. Until this bug is fixed, I’ve just been deleting these duplicates with this recursive command.
find . -name "*.Identifier" -type f -delete
Always do a careful inspection of your model before doing more intense trouble-shooting. I wasted a lot of time because I accidentally changed a 1 to a 100.
I added a favicon to this blog. It should work on all platforms, even if you pin the website as a live-tile on windows phone (rip windows phone).