Show More
@@ -1126,32 +1126,40 b' Currently the magic system has the following functions:\\n"""' | |||||
1126 |
|
1126 | |||
1127 | Examples |
|
1127 | Examples | |
1128 | -------- |
|
1128 | -------- | |
|
1129 | ||||
|
1130 | We first fully reset the namespace so your output looks identical to | |||
|
1131 | this example for pedagogical reasons; in practice you do not need a | |||
|
1132 | full reset. | |||
1129 |
|
1133 | |||
1130 | In [1]: a=1; b=2; c=3; b1m=4; b2m=5; b3m=6; b4m=7; b2s=8 |
|
1134 | In [1]: %reset -f | |
1131 |
|
1135 | |||
1132 | In [2]: who_ls |
|
1136 | Now, with a clean namespace we can make a few variables and use | |
1133 | Out[2]: ['a', 'b', 'b1', 'b1m', 'b2m', 'b2s', 'b3m', 'b4m', 'c'] |
|
1137 | %reset_selective to only delete names that match our regexp: | |
1134 |
|
1138 | |||
1135 | In [3]: %reset_selective -f b[2-3]m |
|
1139 | In [2]: a=1; b=2; c=3; b1m=4; b2m=5; b3m=6; b4m=7; b2s=8 | |
1136 |
|
1140 | |||
1137 |
In [ |
|
1141 | In [3]: who_ls | |
1138 |
Out[ |
|
1142 | Out[3]: ['a', 'b', 'b1m', 'b2m', 'b2s', 'b3m', 'b4m', 'c'] | |
1139 |
|
1143 | |||
1140 |
In [ |
|
1144 | In [4]: %reset_selective -f b[2-3]m | |
1141 |
|
1145 | |||
1142 |
In [ |
|
1146 | In [5]: who_ls | |
1143 |
Out[ |
|
1147 | Out[5]: ['a', 'b', 'b1m', 'b2s', 'b4m', 'c'] | |
1144 |
|
1148 | |||
1145 |
In [ |
|
1149 | In [6]: %reset_selective -f d | |
1146 |
|
||||
1147 | In [8]: who_ls |
|
|||
1148 | Out[8]:['a', 'b', 'b1', 'b1m', 'b2s'] |
|
|||
1149 |
|
1150 | |||
1150 | In [9]: %reset_selective -f b |
|
1151 | In [7]: who_ls | |
1151 |
|
1152 | Out[7]: ['a', 'b', 'b1m', 'b2s', 'b4m', 'c'] | ||
1152 | In [10]: who_ls |
|
1153 | ||
1153 | Out[10]: ['a'] |
|
1154 | In [8]: %reset_selective -f c | |
1154 |
|
1155 | |||
|
1156 | In [9]: who_ls | |||
|
1157 | Out[9]: ['a', 'b', 'b1m', 'b2s', 'b4m'] | |||
|
1158 | ||||
|
1159 | In [10]: %reset_selective -f b | |||
|
1160 | ||||
|
1161 | In [11]: who_ls | |||
|
1162 | Out[11]: ['a'] | |||
1155 | """ |
|
1163 | """ | |
1156 |
|
1164 | |||
1157 | opts, regex = self.parse_options(parameter_s,'f') |
|
1165 | opts, regex = self.parse_options(parameter_s,'f') |
General Comments 0
You need to be logged in to leave comments.
Login now