Issue 50 in netaddr: CIDR block parsing

11 views
Skip to first unread message

codesite...@google.com

unread,
Nov 25, 2009, 5:27:22 PM11/25/09
to net...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 50 by pgurumur: CIDR block parsing
http://code.google.com/p/netaddr/issues/detail?id=50

>>> import netaddr
>>> netaddr.__version__
'0.7.3'
>>> from netaddr import IPNetwork
>>> test = IPNetwork("10.108.10/24")
>>> print test
10.108.0.10/24
>>> test1 = IPNetwork("10/8")
>>> print test1
0.0.0.10/8


Is this expected? it is kind of normal for network engineers to not write
the trailing zeroes, although may not be accurate.


--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

codesite...@google.com

unread,
Nov 25, 2009, 5:32:25 PM11/25/09
to net...@googlegroups.com

Comment #1 on issue 50 by pgurumur: CIDR block parsing
http://code.google.com/p/netaddr/issues/detail?id=50

I am using python 2.5, on OpenBSD 4.6 amd64 bit platform.


Python 2.5.4 (r254:67916, Jul 3 2009, 22:17:21)
[GCC 3.3.5 (propolice)] on openbsd4
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform
>>> platform.python_version()
'2.5.4'
>>> platform.python_compiler()
'GCC 3.3.5 (propolice)'
>>> platform.uname()
('OpenBSD', 'andromeda.kashyapa.net', '4.6', 'GENERIC.MP#3', 'amd64', 'AMD
Athlon(tm)
64 X2 Dual Core Processor 5200+')

codesite...@google.com

unread,
Nov 26, 2009, 5:56:08 AM11/26/09
to net...@googlegroups.com
Updates:
Status: Accepted

Comment #2 on issue 50 by drkjam: CIDR block parsing
http://code.google.com/p/netaddr/issues/detail?id=50

The constructor interface is little quirky and needs updating.

I'll have a look at modifying this behaviour in future versions to make it
less
confusing.

As a workaround, set implicit_prefix=True to obtain the result you need :-

>>> netaddr.IPNetwork('10/8', True)
IPNetwork('10.0.0.0/8')
Reply all
Reply to author
Forward
0 new messages