From ae845f13de8246640835d3be1549a729fd50632f Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky <pfalcon@users.sourceforge.net>
Date: Tue, 3 May 2016 00:48:04 +0300
Subject: [PATCH] docs: Use getaddrinfo() result in easy way.

Instead of extracting 4th element, extact last. Much easier to remember!
---
 docs/library/usocket.rst | 2 +-
 docs/library/ussl.rst    | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/docs/library/usocket.rst b/docs/library/usocket.rst
index 94a1dd213..d31e4d2fc 100644
--- a/docs/library/usocket.rst
+++ b/docs/library/usocket.rst
@@ -49,7 +49,7 @@ Functions
    The following example shows how to connect to a given url::
 
       s = socket.socket()
-      s.connect(socket.getaddrinfo('www.micropython.org', 80)[0][4])
+      s.connect(socket.getaddrinfo('www.micropython.org', 80)[0][-1])
 
 .. only:: port_wipy
 
diff --git a/docs/library/ussl.rst b/docs/library/ussl.rst
index 60be89410..b66e23b2c 100644
--- a/docs/library/ussl.rst
+++ b/docs/library/ussl.rst
@@ -21,7 +21,7 @@ Functions
       import ssl
       s = socket(socket.AF_INET, socket.SOCK_STREAM, socket.IPPROTO_SEC)
       ss = ssl.wrap_socket(s)
-      ss.connect(socket.getaddrinfo('www.google.com', 443)[0][4])
+      ss.connect(socket.getaddrinfo('www.google.com', 443)[0][-1])
 
    Certificates must be used in order to validate the other side of the connection, and also to
    authenticate ourselves with the other end. Such certificates must be stored as files using the
@@ -44,7 +44,7 @@ Functions
       import ssl
       s = socket.socket(socket.AF_INET, socket.SOCK_STREAM, socket.IPPROTO_SEC)
       ss = ssl.wrap_socket(s, cert_reqs=ssl.CERT_REQUIRED, ca_certs='/flash/cert/ca.pem')
-      ss.connect(socket.getaddrinfo('cloud.blynk.cc', 8441)[0][4])
+      ss.connect(socket.getaddrinfo('cloud.blynk.cc', 8441)[0][-1])
 
    SSL sockets inherit all methods and from the standard sockets, see the :mod:`usocket` module.
 
-- 
GitLab