Closed eudoxos closed 2 years ago
Regarding iteration over a proxy, note that it is possible already to return an iterator object from a pyro method. https://pyro5.readthedocs.io/en/latest/clientcode.html?highlight=streaming#remote-iterators-generators
Regarding exposing the dunder methods, the documentation is correct in the sense that these methods can be exposed via Pyro ( 'private' methods starting with underscores are normally not remotely accessible). However actually calling them via special functions seems to not work as expected. I'll look into that (and pr #45 )
I've rewritten the iter implementation.
Some special methods, such as
__len__
or__getitem__
do not go through__getattr__
when called via their special syntax:len(a)
will not look for__len__
using__getattr__
(buta.__len__
will use__getattr__
), just likea[0]
(vs.a.__getitem__
) .Python documentation on Special method lookup says in the last paragraph:
Pyro5 documentation says:
which however does not work as expected — the special syntax such as
len(a)
will not work.The solution would be to define those few special methods on the
Proxy
class itself, and have them raise an exception if they are not really exposed by the proxy.A case in the point is here which uses the workaround of explicit
__getitem__
: