[Python-Dev] PEP 3144 review. (original) (raw)

Antoine Pitrou solipsis at pitrou.net
Sun Sep 27 19:22:41 CEST 2009


Peter Moody <peter hda3.com> writes:

The reason (aside from the name) that I'm not going to include this in ipaddr is that it would require the user to deal with two objects when one would suffice.

You make it sound like it's a burden, but "dealing" with two objects is not something extraordinary or bizarre, it happens all the time when you do network programming: e.g. ('127.0.0.1', 80).

(or would you argue that Address objects should have an optional distinguishing port number, for "convenience" reasons?)

If you need the two objects, whether you access them through separate variables (network and host) or through attribute access (network and network.host) doesn't really matter. You can even pretend the tuple is an atomic object and store it as-is if you want. I'm not sure what annoys you here.

It's similar to getting two return values from float().

I don't see how it's similar, since a float is a clearly defined atomic entity. Most float operations become meaningless if you consider the integral and the fractional part separately.

Regards

Antoine.



More information about the Python-Dev mailing list