On 4/1/21 5:50 AM, Alexey wrote:
Found it. As I said before the problem was lurking in the cache.
Few days ago I read about circular references and things like that and
I thought to myself that it might be the case. To build the cache I was
using lots of 'setdefault' methods chained together

self.__cache.setdefault(cluster_name, {}).setdefault(database_name, {})...

and instead of wring a long lines I decided to divide it to increase
readability

cluster = self.__cache.setdefault(cluster_name, {})
database = database.setdefault(database_name, {})
...
and I guess that was the problem.

I guess it is worth mentioning here that there are people who feel you shouldn't use setdefault() this way. setdefault is primarily a "getter", which has the side effect of filling in dict entry if one did not exist before returning it, and there some folks feel that using it primarily as a "setter" is abusing the interface...

Do with that what you will :)
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to