Closed mwoolweaver closed 3 years ago
less counting and proper list handling by creating empty list's (list =[]) and .append()'ing items to them.
list =[]
.append()
I was creating a list like so nW = [None] * newWhiteListlen - Leaves us with a lot of useless None values
nW = [None] * newWhiteListlen
None
I was also keeping a count to use as an index. - I didn't need to do this because because we can .append() it to the end of the list
Then I'd add items to the list at index it had counted to -
As you see there would be a lot of None values in the list that weren't being used and taking up RAM for no reason.
less counting and proper list handling by creating empty list's (
list =[]
) and.append()
'ing items to them.My previous rookie mistake
I was creating a list like so
nW = [None] * newWhiteListlen
- Leaves us with a lot of uselessNone
valuesI was also keeping a count to use as an index. - I didn't need to do this because because we can
.append()
it to the end of the listThen I'd add items to the list at index it had counted to -
As you see there would be a lot of
None
values in the list that weren't being used and taking up RAM for no reason.