9

I've come back to this question about 4 or 5 times since it was originally posted, started writing up an answer, started doubting my alternative implementation, scrapped it, and then come back about a month later. This tells me a few things: You have a tricky problem, where the "best" solution is not necessarily intuitive, and how you measure "best" can ...


5

We can learn a lot about what code is supposed to do by giving our functions explicit type signatures. Starting at the top, what are we working with? team_id is some kind of Team ID. It's probably a string, or maybe an int, but for now I'll assume it's a TeamID. We know it's exactly what we need because it's passed as-is to the Django filters an SlackUser....


4

Race Conditions You are using 2 concurrent dictionaries, which are each thread-safe, but used together there may be race conditions now and then. Think about possible impact and worst case scenarios. _cooldownTasks = new ConcurrentDictionary<string, Task>(); _pendingNotifications = new ConcurrentDictionary<string, string>(); Thread Pool ...


1

Type hints PEP484 type hints, such as ndim: int, will help better-define your interface. Mutability Reading your code, the other members of CandidateArchive only make sense if fidelities are immutable. As such, don't make them a list - make them a tuple. One advantage is that you can safely give a default argument of ('fitness',), whereas you can't safely ...


Only top voted, non community-wiki answers of a minimum length are eligible