[Python-Dev] PEP 3144 review. (original) (raw)
Greg Ewing greg.ewing at canterbury.ac.nz
Thu Sep 17 04:30:28 CEST 2009
- Previous message: [Python-Dev] PEP 3144 review.
- Next message: [Python-Dev] PEP 3144 review.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Andrew McNamara wrote:
I also suggest the AddressWithMask classes not have any network/container behaviours for a similar reason. If the developer needs these, the .network attribute is only a lookup away.
Another way to approach this would be for the Address object to potentially have a 'network' attribute referencing a Network object.
Then there are only two classes, but three use cases are covered:
a Network
a plain, network-agnostic Address with network == None
an Address with an attached Network
An Address could be constructed in three ways:
Address(ip_number)
Address(ip_number, network = )
Address(ip_number, 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.
-- Greg
- Previous message: [Python-Dev] PEP 3144 review.
- Next message: [Python-Dev] PEP 3144 review.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]