how to kill dictionary entry
dsavitsk
dsavitsk at e-coli.net
Thu May 10 17:50:14 EDT 2001
i have a daemon process running that keeps track of connections to it in a
dictionary. when a client disconnects i set the dictionary value = None,
but the key persists. is there a way to get rid of it totally? for example,
in the code below, i want a[1] and a[2] to throw the same error.
>>> a = {}
>>> a[1] = None
>>> print a[1]
None
>>> print a[2]
Traceback (innermost last):
File "<interactive input>", line 1, in ?
KeyError: 2
thanks,
doug
More information about the Python-list
mailing list