buguroo / pyknow

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

Do not call `__declare` for each fact but only once. #15

Closed nilp0inter closed 6 years ago

nilp0inter commented 6 years ago

For each yielded fact on DefFacts constructs the engine is calling __declare while it can be called only once with a composed generator, resulting in only one __update_agenda call instead of n.

https://github.com/buguroo/pyknow/blob/1aed48fd456209ad58d4d0aeb4188e98cfcbb780/pyknow/engine.py#L189-L192

This is related to #12.