Python 1.6 alpha 1 released

Guido van Rossum guido at
Tue Apr 4 15:49:48 CEST 2000

tseaver at (Tres Seaver) writes:

> The point of this debate is that classifying it as a *bug* is, well,
> debateable.  Years of socket programming experience makes:
>   s.connect( host, port )
> seem like a perfectly reasonable, sane interface;  disallowing it
> may preserve "orthagonality," or some other academic purity, but
> it *breaks existing applications coded to the published interface*,
> with no appreciable real-world benefit (yes, I realize that the published
> interface is inconsistent;  I do not accept the deprecation of the
> examples as a reasonable argument.)  Consider that *every one* of the
> protocol modules which offers a connect() method uses a two-argument
> signature for it:  ftplib, gopherlib, httplib, imaplib, nntplib, poplib,
> smtplib, telnetlib, urllib.  And they all *use* the two-argument connect
> when invoking their underlying socket!  No Python module in the standard
> library uses the single-argument connect, period.
> This is *not* the same case as the list.append() one, where the
> published interface was itself consistent -- I was quite surprised to
> learn just this spring that multi-argument append was even possible.
> But the socket module is one of the first I learned in Python, and I
> have consistenly used the two-argument connect.  Constructing a spurious
> "address" object (which has no behavior, and exists only to be torn
> apart inside the implementation) seems a foolish consistency, beyond
> doubt.
> Rough-consensus-and-running-code-wins-every-time'ly

Before more people mail this to me, let me apologize.  I didn't
realize that there were so many examples of the 2-argument form.  I
don't want to break that much code, so I'll revert the decision in the
next alpha release.

However, I'll do so for purely backwards compatible reasons, and I
will continue to press for the tuple address as the correct form.
This has nothing to do with academic purity.  It is because sockets
are, by their very nature, address family neutral, and not all address
families use a host and a port to identify a socket.  For example,
Unix sockets use just a filename.

The argument that gopherlib c.s. define a 2-arg connect() doesn't mean
that socket should, to: those are all Internet specific protocols,
where host+port is the norm; the lower-level socket API must support
other address families.

The argument that the address object is spurious doesn't hold water.
There are many places where it is convenient to hold an address in a
single variable, and a tuple is the obvious way to represent this.
(The alternative, a "host:port" string, seems too Perlish to me.)
Note also that recvfrom() returns the address as a tuple (if it is an
IP address) and sendto() requires the address to be passed as a tuple
-- the canonical form of an address is clearly a tuple.


But I will fix the code -- it's the only practical thing to do.

--Guido van Rossum (home page:

More information about the Python-list mailing list