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

Andrew McNamara andrewm at object-craft.com.au
Wed Sep 16 04:32:31 CEST 2009


I don't see any valid reason for entering a network as "192.168.1.1/24" rather than the canonical "192.168.1.0/24". The former might indicate a typing error or a mental slip, so let's be helpful and signal it to the user.

Or perhaps there can be an optional "strict=True" (or "strict=False") argument to the constructor / parsing function. I can live w/ a default of strict=False. there are plenty of cases where it's not an error and easy enough ways to check, if the developer is concerned, with or without an option. eg if addr.ip != addr.network:

I agree - there are definitely times when it is not an error, but I don't like the idea of a "strict" flag.

I've done a bit of everything - router configs with a national ISP, scripts to manage host configuration, user interfaces, you name it. The way I see it, we need:

This is along the lines that RDM was suggesting, except that we remove the container behaviour from AddressWithMask.

Additionally:

Personally, I don't see a strong use-case for the list-like indexing and iteration behaviour - I think it's enough to implement some basic container behaviour, but I won't object to the iterator and indexing, provided they don't distort the rest of the design (which I fear they are doing now). Iterating or indexing a network should return Address or AddressWithMask instances - if the later, the mask should match the parent network's mask.

I'm not particularly wedded to the name "AddressWithMask" - maybe it could be NetworkAddress or MaskedAddress or ?

-- Andrew McNamara, Senior Developer, Object Craft http://www.object-craft.com.au/



More information about the Python-Dev mailing list