[docs] Documentation error in function getaddrinfo in socket module

Krishna Kumar Thakur krishnak.thakur at yahoo.com
Tue Mar 12 21:13:21 CET 2013


python version : 3.3.0

Description : getaddrinfo() function expecting 'type' as the keyword argument but
the function documentation says 'socktype' . 

please see the below output
>>> help(getaddrinfo)
Help on built-in function getaddrinfo in module _socket:

    getaddrinfo(host, port [, family, socktype, proto, flags])
        -> list of (family, socktype, proto, canonname, sockaddr)
>>> getaddrinfo.__doc__
'getaddrinfo(host, port [, family, socktype, proto, flags])\n    -> list of (family, socktype, proto, canonname, sockaddr)\n\nResolve host and port into addrinfo struct.'

so if the function is called 
>>> i = getaddrinfo('www.python.org','http',socktype = SOCK_STREAM)
Traceback (most recent call last):
  File "<pyshell#20>", line 1, in <module>
    i = getaddrinfo('www.python.org','http',socktype = SOCK_STREAM)
TypeError: 'socktype' is an invalid keyword argument for this function

then I have found the correct keyword argument as 'type' in python 3.3 official documentation.
Its not the major issue but sometimes it confuses.

As I appreciate python, so I felt its my duty to help make this language error free
as much as possible. :)

Thank You

Krishna Kumar Thakur
Contact: +91-7411251885
E_mail: krishnak.thakur at yahoo.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/docs/attachments/20130312/2326f02c/attachment-0001.html>

More information about the docs mailing list