mathershifter
unread,Jun 29, 2012, 12:37:06 PM6/29/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ipaddr...@googlegroups.com
I was expecting all of seemingly invalid addresses to raise an exception.
Examples:
Python 2.6.5 (r265:79063, Feb 28 2011, 21:55:45)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-50)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import ipaddress
>>>
>>> ipaddress.IPv4Address('999')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.6/site-packages/ipaddress.py", line 1259, in __init__
self._ip = self._ip_int_from_string(addr_str)
File "/usr/lib/python2.6/site-packages/ipaddress.py", line 1067, in _ip_int_from_string
raise AddressValueError(ip_str)
ipaddress.AddressValueError: 999
>>>
>>> ipaddress.IPv4Address('1000')
IPv4Address('49.48.48.48')
>>>
>>> ipaddress.IPv4Address('5000')
IPv4Address('53.48.48.48')
>>>
>>> ipaddress.IPv4Address('9999')
IPv4Address('57.57.57.57')
>>>
>>> ipaddress.IPv4Address('10000')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.6/site-packages/ipaddress.py", line 1259, in __init__
self._ip = self._ip_int_from_string(addr_str)
File "/usr/lib/python2.6/site-packages/ipaddress.py", line 1067, in _ip_int_from_string
raise AddressValueError(ip_str)
ipaddress.AddressValueError: 10000