This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author neologix
Recipients loewis, neologix, pitrou, vstinner
Date 2014-08-03.22:22:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CAH_1eM21hLZg5hUfq+1-2i74Z+QEKLGWsuUKCpTemtjbcMOAJQ@mail.gmail.com>
In-reply-to <CAH_1eM3Ssu49bT-b7e19L4iivnJhCtSkYQwNvC7F=Ur5n7CLZQ@mail.gmail.com>
Content
OK, I think I see what you mean:

$ ./python -m timeit -s "import socket; s =
socket.socket(socket.AF_INET, socket.SOCK_DGRAM)" "s.sendto(b'hello',
('127.0.0.1', 4242))"10000 loops, best of 3: 44.7 usec per loop
$ ./python -m timeit -s "import socket; s =
socket.socket(socket.AF_INET, socket.SOCK_DGRAM)" "s.sendto(b'hello',
(b'127.0.0.1', 4242))"
10000 loops, best of 3: 23.7 usec per loop

That's really surprising, especially since gethostbyname() and
getaddrinfo() seem to return strings:
$ ./python -m timeit -s "import socket; s =
socket.socket(socket.AF_INET, socket.SOCK_DGRAM);
addr=socket.gethostbyname('127.0.0.1')" "s.sendto(b'hello', (addr,
4242))"

$ ./python -c "import socket; print(type(socket.gethostbyname('127.0.0.1')))"
<class 'str'>
History
Date User Action Args
2014-08-03 22:22:19neologixsetrecipients: + neologix, loewis, pitrou, vstinner
2014-08-03 22:22:19neologixlinkissue22127 messages
2014-08-03 22:22:19neologixcreate