On Tue, Sep 15, 2009 at 12:16 PM, Scott Dial <scott+python-dev at scottdial.com<scott%2Bpython-dev at scottdial.com> > wrote: > >>> addr = ipaddr.IPAddress("10.1.2.3/255.255.240.0") > ... > ipaddr.IPAddressIPValidationError: '98.223.189.24/255.255.240.0' is not > a valid address (hint, it's probably a network) > > Because, it *is* a address of a host on a network. I gave in and said: > 10.1.2.3 is the address of a host on a network. 255.255.240.0 is a subnet mask. >>> net = ipaddr.IPNetwork("10.1.2.3/255.255.240.0") > > But then, I was dumbfounded as to how I could get the gateway IP from > this IPNetwork object. It took me a while to figure out that you can > iterate over IPNetwork instances: > Any IP address on an IP network could be the gateway, so there is no reliable way to determine the gateway IP from the network address and subnet mask alone. Technicalities aside, I agree with you that IPNetwork appears to be doing double-duty as an IPNetwork type and an IPAddressWithNetwork type, which I find confusing. -- Daniel Stutzbach, Ph.D. President, Stutzbach Enterprises, LLC <http://stutzbachenterprises.com> -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20090915/c4898aaa/attachment.htm>
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4