Mercurial > cpython-lru_cache-weakref
view Demo/dns/dnsopcode.py @ 4566:6403c94de50d legacy-trunk
Added safeguard against failure in __del__.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Wed, 27 Nov 1996 19:39:58 +0000 |
| parents | 78bf675df5e5 |
| children |
line wrap: on
line source
# Opcode values in message header (section 4.1.1) QUERY = 0 IQUERY = 1 STATUS = 2 # Construct reverse mapping dictionary _names = dir() opcodemap = {} for _name in _names: if _name[0] != '_': opcodemap[eval(_name)] = _name def opcodestr(opcode): if opcodemap.has_key(opcode): return opcodemap[opcode] else: return `opcode`
