Skip to content

Commit

Permalink
Updated docs and issue template to Python 3 syntax as Python 2 has be…
Browse files Browse the repository at this point in the history
…en dropped
  • Loading branch information
comrumino committed Feb 1, 2021
1 parent 775e305 commit 51b0563
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion docs/docs/classic.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ to it like so ::

proc = conn.modules.subprocess.Popen("ls", stdout = -1, stderr = -1)
stdout, stderr = proc.communicate()
print stdout.split()
print(stdout.split())

remote_list = conn.builtin.range(7)

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/services.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Let's have a look at a rather basic service -- a calculator
def exposed_div(self, a, b):
return a / b
def foo(self):
print "foo"
print("foo")

When a client connects, it can access any of the exposed members of the service ::

Expand Down
4 changes: 2 additions & 2 deletions docs/docs/zerodeploy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ it requires only two lines of code::

# and now you can connect to it the usual way
conn1 = server.classic_connect()
print conn1.modules.sys.platform
print(conn1.modules.sys.platform)

# you're not limited to a single connection, of course
conn2 = server.classic_connect()
print conn2.modules.os.getpid()
print(conn2.modules.os.getpid())

# when you're done - close the server and everything will disappear
server.close()
Expand Down
1 change: 0 additions & 1 deletion docs/issue_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ if __name__ == "__main__":
Client:

```python
from __future__ import print_function
import rpyc


Expand Down
8 changes: 4 additions & 4 deletions docs/tutorial/tut4.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,23 @@ Here's an example ::

>>> import rpyc
>>> c = rpyc.classic.connect("localhost")
>>> rlist = c.modules.__builtin__.range(10) # this is a remote list
>>> rlist = c.modules.builtins.list((0,1,2,3,4,5,6,7,8,9)) # this is a remote list
>>> rlist
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>>
>>> def f(x):
... return x**3
...
>>> c.modules.__builtin__.map(f, rlist) # calling the remote map with the local function f as an argument
>>> list(c.modules.builtins.map(f, rlist)) # calling the remote map with the local function f as an argument
[0, 1, 8, 27, 64, 125, 216, 343, 512, 729]
>>>

# and to better understand the previous example
>>> def g(x):
... print "hi, this is g, executing locally", x
... print("hi, this is g, executing locally", x)
... return x**3
...
>>> c.modules.__builtin__.map(g, rlist)
>>> list(c.modules.builtins.map(g, rlist))
hi, this is g, executing locally 0
hi, this is g, executing locally 1
hi, this is g, executing locally 2
Expand Down

0 comments on commit 51b0563

Please sign in to comment.