Charles-François Natali added the comment: 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'> ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue22127> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com