Remove a dict of variables from the user namespace, if they are the same as the values in the dictionary. This is intended for use by extensions: variables that they've added can be taken back out if they are unloaded, without removing any that the user has overwritt
(self, variables)
| 1636 | user_ns_hidden.update(vdict) |
| 1637 | |
| 1638 | def drop_by_id(self, variables): |
| 1639 | """Remove a dict of variables from the user namespace, if they are the |
| 1640 | same as the values in the dictionary. |
| 1641 | |
| 1642 | This is intended for use by extensions: variables that they've added can |
| 1643 | be taken back out if they are unloaded, without removing any that the |
| 1644 | user has overwritten. |
| 1645 | |
| 1646 | Parameters |
| 1647 | ---------- |
| 1648 | variables : dict |
| 1649 | A dictionary mapping object names (as strings) to the objects. |
| 1650 | """ |
| 1651 | for name, obj in variables.items(): |
| 1652 | if name in self.user_ns and self.user_ns[name] is obj: |
| 1653 | del self.user_ns[name] |
| 1654 | self.user_ns_hidden.pop(name, None) |
| 1655 | |
| 1656 | #------------------------------------------------------------------------- |
| 1657 | # Things related to object introspection |