diff options
author | Giampaolo Rodolà <g.rodola@gmail.com> | 2010-08-17 15:30:23 (GMT) |
---|---|---|
committer | Giampaolo Rodolà <g.rodola@gmail.com> | 2010-08-17 15:30:23 (GMT) |
commit | ccfb91c89f9d7515356f31fff4af4c5cbd5eef7a (patch) | |
tree | bec4fcc901fce3653e504c5f24ca0983f2e1e861 /Doc | |
parent | 67b21b7547feee634bbecafeb88606ff350c0d3c (diff) | |
download | cpython-ccfb91c89f9d7515356f31fff4af4c5cbd5eef7a.zip cpython-ccfb91c89f9d7515356f31fff4af4c5cbd5eef7a.tar.gz cpython-ccfb91c89f9d7515356f31fff4af4c5cbd5eef7a.tar.bz2 |
fix issue #8866: parameters passed to socket.getaddrinfo can now be specified as single keyword arguments.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/socket.rst | 13 | ||||
-rw-r--r-- | Doc/whatsnew/3.2.rst | 4 |
2 files changed, 12 insertions, 5 deletions
diff --git a/Doc/library/socket.rst b/Doc/library/socket.rst index f340920..581756f 100644 --- a/Doc/library/socket.rst +++ b/Doc/library/socket.rst @@ -214,7 +214,7 @@ The module :mod:`socket` exports the following constants and functions: *source_address* was added. -.. function:: getaddrinfo(host, port, family=0, socktype=0, proto=0, flags=0) +.. function:: getaddrinfo(host, port, family=0, type=0, proto=0, flags=0) Translate the *host*/*port* argument into a sequence of 5-tuples that contain all the necessary arguments for creating a socket connected to that service. @@ -223,7 +223,7 @@ The module :mod:`socket` exports the following constants and functions: port number or ``None``. By passing ``None`` as the value of *host* and *port*, you can pass ``NULL`` to the underlying C API. - The *family*, *socktype* and *proto* arguments can be optionally specified + The *family*, *type* and *proto* arguments can be optionally specified in order to narrow the list of addresses returned. Passing zero as a value for each of these arguments selects the full range of results. The *flags* argument can be one or several of the ``AI_*`` constants, @@ -233,9 +233,9 @@ The module :mod:`socket` exports the following constants and functions: The function returns a list of 5-tuples with the following structure: - ``(family, socktype, proto, canonname, sockaddr)`` + ``(family, type, proto, canonname, sockaddr)`` - In these tuples, *family*, *socktype*, *proto* are all integers and are + In these tuples, *family*, *type*, *proto* are all integers and are meant to be passed to the :func:`socket` function. *canonname* will be a string representing the canonical name of the *host* if :const:`AI_CANONNAME` is part of the *flags* argument; else *canonname* @@ -249,10 +249,13 @@ The module :mod:`socket` exports the following constants and functions: connection to ``www.python.org`` on port 80 (results may differ on your system if IPv6 isn't enabled):: - >>> socket.getaddrinfo("www.python.org", 80, 0, 0, socket.SOL_TCP) + >>> socket.getaddrinfo("www.python.org", 80, proto=socket.SOL_TCP) [(2, 1, 6, '', ('82.94.164.162', 80)), (10, 1, 6, '', ('2001:888:2000:d::a2', 80, 0, 0))] + .. versionchanged:: 3.2 + parameters can now be passed as single keyword arguments. + .. function:: getfqdn([name]) Return a fully qualified domain name for *name*. If *name* is omitted or empty, diff --git a/Doc/whatsnew/3.2.rst b/Doc/whatsnew/3.2.rst index 2c625a8..d03a67f 100644 --- a/Doc/whatsnew/3.2.rst +++ b/Doc/whatsnew/3.2.rst @@ -181,6 +181,10 @@ New, Improved, and Deprecated Modules (Contributed by Georg Brandl; :issue:`5675`.) +* Parameters passed to :func:`socket.getaddrinfo()` function can now be + specified as single keyword arguments. + + (Contributed by Giampaolo Rodolà; :issue:`8866`.) Multi-threading =============== |