The default arguments of the Engine__init__ function were mutable.
That means, they are shared across all instances of Engine.
See here for details on this property of python.
I noticed this when creating multiple instances of Engine.
Since I didn't specify any argument for storage, it defaulted to MemoryStorage().
Because MemoryStorage() is specified in the function arguments there was only one storage instance shared by all the engines that I created.
Every time I queried nearest neighbors, they were retrieved from all the datasets in all my engines, the datasets were not separated as I intended.
I added a quick fix following a style that is recommended by most articles about the mutual default argument matter.
The default arguments of the
Engine
__init__
function were mutable. That means, they are shared across all instances of Engine. See here for details on this property of python.I noticed this when creating multiple instances of
Engine
. Since I didn't specify any argument forstorage
, it defaulted toMemoryStorage()
. BecauseMemoryStorage()
is specified in the function arguments there was only one storage instance shared by all the engines that I created. Every time I queried nearest neighbors, they were retrieved from all the datasets in all my engines, the datasets were not separated as I intended.I added a quick fix following a style that is recommended by most articles about the mutual default argument matter.