mlpy.auxiliary.misc.remove_key

mlpy.auxiliary.misc.remove_key(d, key)[source]

Safely remove the key from the dictionary.

Safely remove the key from the dictionary d by first making a copy of dictionary. Return the new dictionary together with the value stored for the key.

Parameters:

d : dict

The dictionary from which to remove the key.

key :

The key to remove

Returns:

v :

The value for the key

r : dict

The dictionary with the key removed.