irmen / Pyro5

Pyro 5 - Python remote objects
https://pyro5.readthedocs.io
MIT License
303 stars 36 forks source link

Let properties be generators too #86

Open mawildoer opened 7 months ago

mawildoer commented 7 months ago

I'm sure there's a better way to achieve this - but this tweak means properties can be generators too.

I did note that in the case you tried to call it as a method still, the error kinda sucked, but I think it's okay:

Pyro traceback:
Traceback (most recent call last):
  File "<ipython-input-34-268747a29aa7>", line 3, in <module>
    for results in dummy.thingos():
                   ^^^^^^^^^^^^^^^
TypeError: '_StreamResultIterator' object is not callable

This function's also pretty enormous, so perhaps there's a good place to pull this section of repeated code out to?

irmen commented 7 months ago

Could you perhaps also add a unit test for this? I think TestServerOnce in test_server.py contains tests that check iteration and such