msg106817 - (view) |
Author: Giampaolo Rodola' (giampaolo.rodola) *  |
Date: 2010-05-31 22:50 |
As of now socket.getaddrinfo() only supports positional arguments, so that if I want to, say, specify "flags" argument I'm forced to specify "0" for other missing arguments: >>> socket.getaddrinfo("www.python.org", 0, 0, 0, socket.SOL_TCP) [(2, 1, 6, '', ('82.94.164.162', 0)), (10, 1, 6, '', ('2001:888:2000:d::a2', 0, 0, 0))] >>> >>> socket.getaddrinfo("www.python.org", flags=socket.SOL_TCP) Traceback (most recent call last): File "", line 1, in TypeError: getaddrinfo() takes no keyword arguments >>> |
|
|
msg106818 - (view) |
Author: Giampaolo Rodola' (giampaolo.rodola) *  |
Date: 2010-05-31 22:52 |
...also, the returning tuples could be named tuples instead. |
|
|
msg106909 - (view) |
Author: Giampaolo Rodola' (giampaolo.rodola) *  |
Date: 2010-06-02 20:08 |
The patch in attachment implements keyword arguments. |
|
|
msg106917 - (view) |
Author: Giampaolo Rodola' (giampaolo.rodola) *  |
Date: 2010-06-02 21:33 |
Created issue 8881 to treat the named tuples issue separately. |
|
|
msg113919 - (view) |
Author: Giampaolo Rodola' (giampaolo.rodola) *  |
Date: 2010-08-14 18:04 |
Updated patch in attachment includes tests and doc update. I decided to rename "socktype" argument in "type", since that's the name adopted all across the socket module API: socket.socket([family[, type[, proto]]]) socket.socket.type socket.socketpair([family[, type[, proto]]]) socket.fromfd(fd, family, type[, proto]) This is safe and doesn't introduce any incompatibility. |
|
|
msg113933 - (view) |
Author: Antoine Pitrou (pitrou) *  |
Date: 2010-08-14 21:57 |
-.. function:: getaddrinfo(host, port, family=0, socktype=0, proto=0, flags=0) +.. function:: getaddrinfo(host, port[, family[, type[, proto[, flags]]]]) You should keep using the new documentation convention, that is: .. function:: getaddrinfo(host, port, family=0, type=0, proto=0, flags=0) |
|
|
msg114125 - (view) |
Author: Giampaolo Rodola' (giampaolo.rodola) *  |
Date: 2010-08-17 14:55 |
Isn't that exactly as it was before? Being now possible to specify single keyword arguments aren't "[" brackets necessary? |
|
|
msg114129 - (view) |
Author: Giampaolo Rodola' (giampaolo.rodola) *  |
Date: 2010-08-17 15:31 |
Committed in r84143 including the doc change as suggested by Antoine. |
|
|