anudeepND / whitelist

A simple tool to add commonly white listed domains to your Pi-Hole setup.
MIT License
4.18k stars 281 forks source link

less counting and proper list handling #183

Closed mwoolweaver closed 3 years ago

mwoolweaver commented 3 years ago

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 useless None values

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.