[Python-Dev] PEP 3144 review. (original) (raw)
Andrew McNamara andrewm at object-craft.com.au
Thu Sep 17 05:27:43 CEST 2009
- Previous message: [Python-Dev] PEP 3144 review.
- Next message: [Python-Dev] conceptual clarity
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Another way to approach this would be for the Address object to potentially have a 'network' attribute referencing a Network object.
Yes - that's reasonable.
Then there are only two classes, but three use cases are covered:
1) a Network 2) a plain, network-agnostic Address with network == None 3) an Address with an attached Network An Address could be constructed in three ways: Address(ipnumber) Address(ipnumber, network = ) Address(ipnumber, mask = ) # constructs and attaches a suitably-masked Network instance
I think you still need to support the common notations:
Address('10.0.0.1') # .network == None
Address('10.0.0.1/255.255.255.0')
Address('10.0.0.1/24')
We could also have somenetwork[n] return an Address referring back to the network object it was obtained from.
Yes.
(Of course, we're simplifying - there would really be classes for each protocol).
-- Andrew McNamara, Senior Developer, Object Craft http://www.object-craft.com.au/
- Previous message: [Python-Dev] PEP 3144 review.
- Next message: [Python-Dev] conceptual clarity
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]