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 o
(self, variables)
| 1579 | user_ns_hidden.update(vdict) |
| 1580 | |
| 1581 | def drop_by_id(self, variables): |
| 1582 | """Remove a dict of variables from the user namespace, if they are the |
| 1583 | same as the values in the dictionary. |
| 1584 | |
| 1585 | This is intended for use by extensions: variables that they've added can |
| 1586 | be taken back out if they are unloaded, without removing any that the |
| 1587 | user has overwritten. |
| 1588 | |
| 1589 | Parameters |
| 1590 | ---------- |
| 1591 | variables : dict |
| 1592 | A dictionary mapping object names (as strings) to the objects. |
| 1593 | """ |
| 1594 | for name, obj in variables.items(): |
| 1595 | if name in self.user_ns and self.user_ns[name] is obj: |
| 1596 | del self.user_ns[name] |
| 1597 | self.user_ns_hidden.pop(name, None) |
| 1598 | |
| 1599 | #------------------------------------------------------------------------- |
| 1600 | # Things related to object introspection |