Pyro4 now with remote iterators

Irmen de Jong irmen.NOSPAM at xs4all.nl
Wed Oct 19 16:03:45 EDT 2016


Hi,

I have just released Pyro4 version 4.49; https://pypi.python.org/pypi/Pyro4

(super short description: it is a library that allows you to transparently call methods
on objects that are running on other machines, as if they were local)

Pyro now also supports remote iterators. This means you can loop over a remote iterator
(or generator) that is running on another machine, and get the items on demand as they
are consumed by your client code.

Server:

class RemoteObject:
    @Pyro4.expose
    def numbers(self):
        i = 0
        while i<10:
            yield i
            i += 1

Client:

r = Pyro4.Proxy(".....")
for number in r.numbers():
    print(number)


When used correctly this feature can avoid having to build large data structures and
returning those all at once from a remote call. Instead, you now can return them
piecemeal and only that which is actually used by the client.

The feature is also supported by the Pyrolite client library for Java and .NET/C#.
I think it is pretty nifty and interesting enough to post about it here :)


Regards
Irmen de Jong



More information about the Python-list mailing list