diff options
author | pmoody@google.com <pmoody@google.com@09200d28-7f98-11dd-ad27-0f66e57d2035> | 2010-02-23 23:45:29 +0000 |
---|---|---|
committer | pmoody@google.com <pmoody@google.com@09200d28-7f98-11dd-ad27-0f66e57d2035> | 2010-02-23 23:45:29 +0000 |
commit | 34acff7cd9fabb4069d1dce7c48dcd51410ab6dc (patch) | |
tree | a9456a03551fb9315c3ac102f7d3acf268004d44 | |
parent | cbaea667304af21fec7b249a7fe6aa3d965ff4a2 (diff) | |
download | ipaddr-py-34acff7cd9fabb4069d1dce7c48dcd51410ab6dc.tar.gz |
Edited wiki page through web user interface.
git-svn-id: https://ipaddr-py.googlecode.com/svn@152 09200d28-7f98-11dd-ad27-0f66e57d2035
-rw-r--r-- | wiki/UpgradingTo2x.wiki | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/wiki/UpgradingTo2x.wiki b/wiki/UpgradingTo2x.wiki index 14e7eec..47547d3 100644 --- a/wiki/UpgradingTo2x.wiki +++ b/wiki/UpgradingTo2x.wiki @@ -57,11 +57,23 @@ The network and address methods between the various IP versions are identical, s ipaddr 1.x relied mostly on the monolithic IP(string) constructor. This would return either a IPv4 or IPv6 object. There are now two main constructors, {{{ IPAddress(address_string) }}} and {{{ IPNetwork(address_string) }}}. These constructors try to determine the type, either v4 or v6, of string or int and then return an appropriately-typed object. + *more to come* === Accessors === -*more to come* +2.x makes much greater use of pythons special methods for returning the integer or string representations of an object. + +|| 1.x || 2.x || +|| network.ip_ext || str(network) || +|| network.ip || int(network) || +|| network.netmask_ext || str(network.netmask) || +|| network.netmask || int(network.netmask) || +|| network.broadcast_ext || str(network.broadcast) || +|| network.broadcast || int(network.broadcast) || + +Additionally, the various network attributes ({{{ .ip, .ip_ext, .network, .network_ext, .broadcast, .broadcast_ext }}}) used to return either strings or ints. As mentioned before, they return ipaddr address objects, either of type {{{IPv4Address}}} or {{{IPv6Address}}}. + === Exceptions === @@ -75,4 +87,4 @@ In general, the exceptions are much more "pythonic". No more inventing excepti || ipaddr.IPv6NetmaskValidationError || ipaddr.NetmaskValueError || || ipaddr.IPTypeError || TypeError || || ipaddr.IPAddressExclussionError || ValueError || -|| ipaddr.PrefixLenDiffInvalidError || ValueError || +|| ipaddr.PrefixLenDiffInvalidError || ValueError ||
\ No newline at end of file |