Logo Search packages:      
Sourcecode: virt-manager version File versions  Download package

def virtManager::IPy::IPint::__hash__ (   self  ) 

Called for the key object for dictionary operations, and by
the built-in function hash()  Should return a 32-bit integer
usable as a hash value for dictionary operations. The only
required property is that objects which compare equal have the
same hash value

>>> hex(IP('10.0.0.0/24').__hash__())
'0xf5ffffe7'

Definition at line 773 of file IPy.py.

00773                       :
        """Called for the key object for dictionary operations, and by
        the built-in function hash()  Should return a 32-bit integer
        usable as a hash value for dictionary operations. The only
        required property is that objects which compare equal have the
        same hash value

        >>> hex(IP('10.0.0.0/24').__hash__())
        '0xf5ffffe7'
        """

        thehash = int(-1)
        ip = self.ip
        while ip > 0:
            thehash = thehash ^ (ip & 0x7fffffff)
            ip = ip >> 32
        thehash = thehash ^ self._prefixlen
        return int(thehash)


class IP(IPint):


Generated by  Doxygen 1.6.0   Back to index