PyDocs

Nav

Internet Protocols and Support

get_mixed_type_key

ipaddress

function (source)
  • get_mixed_type_key(obj)
Return a key suitable for sorting between networks and addresses.

Address and Network objects are not sortable by default; they're
fundamentally different so the expression

    IPv4Address('192.0.2.0') <= IPv4Network('192.0.2.0/24')

doesn't make any sense.  There are some times however, where you may wish
to have ipaddress sort these for you anyway. If you need to do this, you
can use this function as the key= argument to sorted().

Args:
  obj: either a Network or Address object.
Returns:
  appropriate key.
0 Examples
No examples for ipaddress/get_mixed_type_key.
See Also
No see-alsos for ipaddress/get_mixed_type_key
0 Notes
No notes for get_mixed_type_key