I watched Ned's video and now have a question. (Refer to the picture at 3:30)
I had originally planned to implement a translator/simplifier, which iterates through a list of which there are many duplicates, and in order of which unique value it found, it would create a pair list of smaller strings.
E.g.
would become
allowing me to replace the original array with
Then, I would replace the values of my array with 1000 elements in it, with the number version, rather than full string. Hence, the
However, in python, would that make a difference? Or does python check if two variables are pointing to the same memory/value, rather than the value itself?
Thank you in advance.
I had originally planned to implement a translator/simplifier, which iterates through a list of which there are many duplicates, and in order of which unique value it found, it would create a pair list of smaller strings.
E.g.
def getSimplified(symbol): tb_new = False for x in sa_symbols: if symbol == x: tb_new = True break if tb_new == True: sa_symbols.append(symbol, len(sa_symbols))E.g.
[Korea, Korea, Japan, China, China, Korea, Taiwan]
would become
[[0, Korea], [1, Japan], [2, China], [3, Taiwan]]
allowing me to replace the original array with
[0, 0, 1, 2, 2, 0, 3]
Then, I would replace the values of my array with 1000 elements in it, with the number version, rather than full string. Hence, the
==
comparison would be much quicker.However, in python, would that make a difference? Or does python check if two variables are pointing to the same memory/value, rather than the value itself?
Thank you in advance.