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

Tres Seaver tseaver at palladion.com
Thu Sep 17 06:14:12 CEST 2009


-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1

Scott Dial wrote:

The purpose is to avoid conflating IPNetwork with an IPAddress that has a mask.

I'm not confused by anything in this discussion except the repeated harping on the (to me imaginary) concept of "address with a mask". Conceptually:

At the API level, it is convenient to represent the combination (address, mask) as a single string (e.g., '192.168.1.0/24'): parsing that string should return a network, not an address. Let's keep the "parsing human readable / writable strings" part separate from the clear conceptual map.

If the IPNetwork didn't accept a non-zero host and instead required a developer to use a helper to construct a IPNetwork with a proper address, then there would be less confusion about what exactly a IPNetwork is meant to represent. As it stands, it's purposes is muddled by accepting host addresses too.

I can't imagine why it would be useful to try to infer a network from an address: "In the face of ambiguity, refuse the temptation to guess."

I am rather indifferent whether there needs to be a IPAddressWithMask type. If that is needed, then it is rather easy to create a type that does that. And, if it is a common pattern, then it could be added to the module later in life.

Agreed.

Tres. - --

Tres Seaver +1 540-429-0999 tseaver at palladion.com Palladion Software "Excellence by Design" http://palladion.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFKsbeU+gerLs4ltQ4RAlG0AJ9ZvhuXHsTL2hheW/vlzeMmArs5rgCeLDLS eKWSAdkdv++umepu+nK0/7I= =N7ej -----END PGP SIGNATURE-----



More information about the Python-Dev mailing list