[New-bugs-announce] [issue6175] inet_aton documentation kind of lies

Daniel Svensson report at bugs.python.org
Tue Jun 2 10:06:07 CEST 2009


New submission from Daniel Svensson <dsvensson at gmail.com>:

The documentation for inet_aton specifically says that it's used to
"Convert an IPv4 address from dotted-quad string format". This however
is not really true, it does accept dotted-quad, but not dotted-quad
alone, but also these forms from inet(3) man page:

       a.b.c.d   Each of the four numeric parts specifies a byte of the
address; the bytes are assigned in left-to-right order to produce the
binary address.

       a.b.c     Parts a and b specify the first two bytes of the binary
address.  Part c is interpreted as a 16-bit value that defines the
rightmost two bytes of the binary address.  This notation is suitable
for specifying (outmoded) Class B network addresses.

       a.b       Part a specifies the first byte of the binary address.
 Part b is interpreted as a 24-bit value that defines the rightmost
three bytes of the binary address.  This notation is suitable for
specifying (outmoded) Class C network addresses.

       a         The value a is interpreted as a 32-bit value that is
stored directly into the binary address without any byte rearrangement.

Sure, it references the man-page, but if anything it should say among
the formats it supports, dotted-quad is *one* of them.

http://docs.python.org/library/socket.html#socket.inet_aton

----------
assignee: georg.brandl
components: Documentation
messages: 88725
nosy: dsvensson, georg.brandl
severity: normal
status: open
title: inet_aton documentation kind of lies
versions: Python 2.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6175>
_______________________________________


More information about the New-bugs-announce mailing list