MCPcopy Index your code
hub / github.com/ipython/ipython / reset

Method reset

IPython/core/magics/namespace.py:489–618  ·  view source on GitHub ↗

Resets the namespace by removing all names defined by the user, if called without arguments, or by removing some types of objects, such as everything currently in IPython's In[] and Out[] containers (see the parameters for details). Parameters ----------

(self, parameter_s='')

Source from the content-addressed store, hash-verified

487
488 @line_magic
489 def reset(self, parameter_s=''):
490 """Resets the namespace by removing all names defined by the user, if
491 called without arguments, or by removing some types of objects, such
492 as everything currently in IPython's In[] and Out[] containers (see
493 the parameters for details).
494
495 Parameters
496 ----------
497 -f
498 force reset without asking for confirmation.
499 -s
500 'Soft' reset: Only clears your namespace, leaving history intact.
501 References to objects may be kept. By default (without this option),
502 we do a 'hard' reset, giving you a new session and removing all
503 references to objects from the current session.
504 --aggressive
505 Try to aggressively remove modules from sys.modules ; this
506 may allow you to reimport Python modules that have been updated and
507 pick up changes, but can have unintended consequences.
508
509 in
510 reset input history
511 out
512 reset output history
513 dhist
514 reset directory history
515 array
516 reset only variables that are NumPy arrays
517
518 See Also
519 --------
520 reset_selective : invoked as ``%reset_selective``
521
522 Examples
523 --------
524 ::
525
526 In [6]: a = 1
527
528 In [7]: a
529 Out[7]: 1
530
531 In [8]: 'a' in get_ipython().user_ns
532 Out[8]: True
533
534 In [9]: %reset -f
535
536 In [1]: 'a' in get_ipython().user_ns
537 Out[1]: False
538
539 In [2]: %reset -f in
540 Flushing input history
541
542 In [3]: %reset -f dhist in
543 Flushing directory history
544 Flushing input history
545
546 Notes

Callers

nothing calls this directly

Calls 7

who_lsMethod · 0.95
parse_optionsMethod · 0.80
ask_yes_noMethod · 0.80
popMethod · 0.80
flushMethod · 0.45
updateMethod · 0.45
collectMethod · 0.45

Tested by

no test coverage detected