[Python-Dev] conceptual clarity (original) (raw)

Peter Moody peter at hda3.com
Thu Sep 17 18:16:46 CEST 2009


On Thu, Sep 17, 2009 at 5:32 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:

Eric Smith wrote:

Antoine Pitrou wrote:

As it is, -1 from me. Either we only keep two concepts (Address and  Network), or if we introduce a third one (AddressWithMask, whatever) for added practicality; but we shouldn't blur the line between the two former canonical concepts under the pretext that a platypus-like Address might be helpful in some particular situations.

I completely agree with this. By keeping the concepts distinct we can  catch mis-uses earlier. If needed, convenience functions (or classes, or whatever) could be layered on top. But the underlying concepts need to be clear. That would be my view as well (this includes getting rid of the current duality of IPNetwork by dropping the ip property, only accepting the network address in the normal constructor and having a separate constructor that allows a network object to be created from an arbitrary  host address and a netmask)

Again, the same error-catching functionality can be obtained through an option to the constructor. network and broadcast attributes can be renamed to .\1_address to alleviate confusion as well.

I mentioned before that IPy's insistence on receiving masked out networks was one of the main reasons I wrote ipaddr to begin with. Having ipaddr mimic this behavior would make it significantly less useful. Removing functionality in the name of avoiding confusion doesn't make sense when the same confusion can be alleviated w/o the loss.

off to patch the pep and implement some of the non controversial changes. /peter

Is-a-2.x-str-a-sequence-of-ASCII-characters-or-a-chunk-of-binary-data?'ly, Nick.

-- Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia ---------------------------------------------------------------


Python-Dev mailing list Python-Dev at python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/python-dev%40hda3.com



More information about the Python-Dev mailing list