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

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Oct 1 00:41:42 CEST 2009


Paul Moore wrote:

linus and snoopy are hosts not networks, so making them IPv4Network classes seems wrong. I'd instinctively make them IPv4Address objects (which, I believe, would work).

However, by allowing IPNetwork objects to also contain a host address, we seem to be officially sanctioning such abuse, or at least turning a blind eye to it.

It's possible that the user is thinking of linus and snoopy as being both networks and host addresses, in which case this kind of mistake will be easy to make. Not to mention the potential confusion in the mind of someone trying to read or maintain the code.

My feeling is that we shouldn't accept this kind of compromise as being "good enough". Once a module is in the stdlib, we're going to be stuck with it for quite a while, so I think it's worth taking some time to make sure that what we adopt is based on a conceptually sound design.

Peter is of course within his rights not to change his module in this way. But this just means that ipaddr is not the right module to adopt, and we should design another one and give it a different name.

-- Greg



More information about the Python-Dev mailing list