mayank gupta wrote:
Hi all,

I wanted to know whether there is a more efficient way to delete an entry from a dictionary (instead of using the 'del' function), because after analyzing the time taken by the code, it seems to me that the 'del' function takes most of the time.

That is hard to imagine.

del ob[sub]

has the same effect as

ob.__delitem__(sub)

but I suspect this would take longer since it requires a runtime attribute lookup and Python level function call. So I am pretty sure the answer is 'no'.

tjr

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to