MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/mxlgzm/very_efficient_and_scalable_code/gvqf8dx/?context=3
r/badcode • u/Conqu3red • Apr 24 '21
110 comments sorted by
View all comments
-51
Still pretty readable, and I can't quickly think of an improvement
96 u/RoboticPlayer Apr 24 '21 Just pass it as a parameterdef chooseTag(tag): if tag in selectedTags: selectedTags.remove(tag) else: selectedTags.append(tag) print(selectedTags) 6 u/lizard450 Apr 24 '21 Use a hashtable would be an improvement... Or an enum bit array. 5 u/RoboticPlayer Apr 24 '21 True, but what I did is simple and it's what I thought of off the top of my head :) 2 u/lizard450 Apr 24 '21 That's how you get to good code. A series of simple improvements.
96
Just pass it as a parameter
def chooseTag(tag): if tag in selectedTags: selectedTags.remove(tag) else: selectedTags.append(tag) print(selectedTags)
6 u/lizard450 Apr 24 '21 Use a hashtable would be an improvement... Or an enum bit array. 5 u/RoboticPlayer Apr 24 '21 True, but what I did is simple and it's what I thought of off the top of my head :) 2 u/lizard450 Apr 24 '21 That's how you get to good code. A series of simple improvements.
6
Use a hashtable would be an improvement... Or an enum bit array.
5 u/RoboticPlayer Apr 24 '21 True, but what I did is simple and it's what I thought of off the top of my head :) 2 u/lizard450 Apr 24 '21 That's how you get to good code. A series of simple improvements.
5
True, but what I did is simple and it's what I thought of off the top of my head :)
2 u/lizard450 Apr 24 '21 That's how you get to good code. A series of simple improvements.
2
That's how you get to good code. A series of simple improvements.
-51
u/NetherFX Apr 24 '21
Still pretty readable, and I can't quickly think of an improvement