> Isn't there a way to accomplish the desired effect without modifying > the instance? In the context of __findattr__, *we* know that we > don't want to get a recursive call. Let's assume __getattr__ and > __setattr__ had yet another optional parameter: infindattr, > defaulting to 0. We would than have to pass a positive value in > this context, which would object.c tell to not try to invoke > __findattr__ again. Who is "we" here? The Python code implementing __findattr__? How would it pass a value to __setattr__? It doesn't call __setattr__, instead it has "self.__myfoo = x"... I agree that the current implementation is not thread-safe. To solve that, you'd need to associate with each instance not a single "infindattr" attribute, but a whole set of them - one per "thread of execution" (which would be a thread-id in most threading systems). Of course, that would need some cooperation from the any thread scheme (including uthreads), which would need to provide an identification for a "calling context". Regards, Martin
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4