buguroo / pyknow

PyKnow: Expert Systems for Python
GNU Lesser General Public License v3.0
470 stars 141 forks source link

Do not search on Counter.elements() to find duplicate facts. #16

Closed nilp0inter closed 6 years ago

nilp0inter commented 6 years ago

https://github.com/buguroo/pyknow/blob/1aed48fd456209ad58d4d0aeb4188e98cfcbb780/pyknow/factlist.py#L71-L72

Counter.elements() generates an iterable which we have to traverse resulting on O(n) complexity instead of O(1) if we search directly over keys. Do'h!

This is related to #12.