Antoine Pitrou wrote:
Le Thu, 17 Sep 2009 14:30:28 +1200, Greg Ewing a écrit :
3) an Address with an attached Network
An Address could be constructed in three ways:
Address(ip_number)
Address(ip_number, network = <Network instance>)
Address(ip_number, mask = <mask>)
# constructs and attaches a suitably-masked Network instance
We could also have some_network[n] return an Address referring back to
the network object it was obtained from.
It seems you are uselessly conflating two perfectly distinct concepts:
Address and Network. You also haven't addresses the issue of comparing
together (and hashing) two addresses with the same IP but pointing to a
different network. No answer to this issue seems satisfactory and
obviously right.
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.
Eric.
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com