The base class containing common functionality for all subclasses
representing various network address types.
It is a fully functioning class (as opposed to a virtual class) with a
heuristic constructor that detects the type of address via the first
argument if it is a string and sets itself up accordingly. If the first
argument is an integer, then a constant must be provided via the second
argument indicating the address type explicitly.
Objects of this class behave differently dependent upon the type of
address they represent.
|
|
|
|
|
|
|
|
|
|
|
|
|
bits(self,
word_sep=None)
Returns:
human-readable binary digit string of this address |
source code
|
|
|
|
|
bin(self)
Returns:
standard Python binary representation of this address. |
source code
|
|
|
|
|
|
|
__getitem__(self,
index)
Returns:
The integer value of the word referenced by index (both positive and
negative). |
source code
|
|
|
__setitem__(self,
index,
value)
Sets the value of the word referenced by index in this address |
source code
|
|
|
__hex__(self)
Returns:
hexadecimal string representation of this address (in network byte
order). |
source code
|
|
|
|
|
|
|
__add__(self,
other)
Returns:
A new (potentially larger) Addr class/subclass instance. |
source code
|
|
|
__sub__(self,
other)
Returns:
A new (potentially smaller) Addr class/subclass instance. |
source code
|
|
|
__eq__(self,
other)
Returns:
True if this address is numerically the same as other,
False otherwise. |
source code
|
|
|
__ne__(self,
other)
Returns:
False if this address is numerically the same as the
other, True otherwise. |
source code
|
|
|
__lt__(self,
other)
Returns:
True if this address is numerically lower in value than
other, False otherwise. |
source code
|
|
|
__le__(self,
other)
Returns:
True if this address is numerically lower or equal in
value to other, False otherwise. |
source code
|
|
|
__gt__(self,
other)
Returns:
True if this address is numerically greater in value
than other, False otherwise. |
source code
|
|
|
__ge__(self,
other)
Returns:
True if this address is numerically greater or equal in
value to other, False otherwise. |
source code
|
|
|
__or__(self,
other)
Returns:
bitwise OR (x | y) between the integer value of this IP address and
another. |
source code
|
|
|
__and__(self,
other)
Returns:
bitwise AND (x & y) between the integer value of this address and
another. |
source code
|
|
|
__xor__(self,
other)
Returns:
bitwise exclusive OR (x ^ y) between the integer value of this
address and another. |
source code
|
|
|
__lshift__(self,
numbits)
Returns:
an address based on this one with its integer value left shifted by x
bits. |
source code
|
|
|
__rshift__(self,
numbits)
Returns:
an address based on this one with its integer value right shifted by
x bits. |
source code
|
|
|
__nonzero__(self)
Returns:
True if the numerical value of this address is not zero, False
otherwise. |
source code
|
|
Inherited from object :
__delattr__ ,
__getattribute__ ,
__new__ ,
__reduce__ ,
__reduce_ex__ ,
__setattr__
|