Index: Doc/library/xmlrpc.client.rst =================================================================== --- Doc/library/xmlrpc.client.rst (revision 69375) +++ Doc/library/xmlrpc.client.rst (working copy) @@ -283,9 +283,8 @@ import xmlrpc.client def python_logo(): - handle = open("python_logo.jpg") - return xmlrpc.client.Binary(handle.read()) - handle.close() + with open("python_logo.jpg") as handle: + return xmlrpc.client.Binary(handle.read()) server = SimpleXMLRPCServer(("localhost", 8000)) print("Listening on port 8000...") @@ -298,9 +297,8 @@ import xmlrpc.client proxy = xmlrpc.client.ServerProxy("http://localhost:8000/") - handle = open("fetched_python_logo.jpg", "w") - handle.write(proxy.python_logo().data) - handle.close() + with open("fetched_python_logo.jpg", "w") as handle: + handle.write(proxy.python_logo().data) .. _fault-objects: