Get dict value but not as reference.

Robert Rawlins robert.rawlins at
Wed Jul 23 17:49:11 CEST 2008



This feels like a strange question but it's not something I've done before,
I'm sure it's quite simple.


I have a dictionary, and I want to get one of the values from it, but rather
than returning it as a reference I want to actually detach/remove the
element from the dictionary. Like so:


Def get_something():

                Something = self.my_dict["keythatIwanttoredetach"]


                Return something


I can then use something, however, it no longer exists in the dictionary.


Sorry, I couldn't really explain this very well. How can I achieve this?






-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list