[issue3959] Add Google's ipaddr.py to the stdlib

pmoody report at bugs.python.org
Thu Jan 1 03:33:13 CET 2009


pmoody <python at hda3.com> added the comment:

> I'm not sure which API in netaddr you're referring to.  If you want to
> construct that /24 with netaddr, then I would use
> netaddr.address.CIDR("1.1.1.0/24").  Offhand, I can't find an API which

netaddr.AddrRange

class AddrRange(__builtin__.object)
 |  A block of contiguous network addresses bounded by an arbitrary start and
 |  stop address. There is no requirement that they fall on strict bit mask
 |  boundaries, unlike L{CIDR} addresses.
 |

 |  __init__(self, first, last, klass=<class 'netaddr.address.Addr'>)
 |      Constructor.
 |
 |      @param first: start address for this network address range.
 |
 |      @param last: stop address for this network address range.
 |
 |      @param klass: (optional) class used to create each object returned.
 |          Default: L{Addr()} objects. See L{nrange()} documentations for
 |          additional details on options.

when looking through the code.google.com wiki, I couldn't find any
examples of creating addresses with netmasks and AddrRange was the
first thing I found when looking through pydoc.

> accepts two endpoints of a range to construct a network in netaddr.
> When I wrote about having separate types for individual addresses vs
> ranges of addresses in my previous comment, I had IP and CIDR
> respectively in mind, as opposed to ipaddr-py's single IPv4 class which
> can represent either.

and still having two separate classes represent the same thing seems odd to me.

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3959>
_______________________________________


More information about the Python-bugs-list mailing list