##// END OF EJS Templates
Added examples for magic commands : who, whols, whos
Ramana -
Show More
@@ -731,7 +731,26 b' Currently the magic system has the following functions:\\n"""'
731 """Return a sorted list of all interactive variables.
731 """Return a sorted list of all interactive variables.
732
732
733 If arguments are given, only variables of types matching these
733 If arguments are given, only variables of types matching these
734 arguments are returned."""
734 arguments are returned.
735
736 Examples
737 --------
738
739 Define two variables and list them with who_ls::
740
741 In [1]: alpha = 123
742
743 In [2]: beta = 'test'
744
745 In [3]: %who_ls
746 Out[3]: ['alpha', 'beta']
747
748 In [4]: %who_ls int
749 Out[4]: ['alpha']
750
751 In [5]: %who_ls str
752 Out[5]: ['beta']
753 """
735
754
736 user_ns = self.shell.user_ns
755 user_ns = self.shell.user_ns
737 internal_ns = self.shell.internal_ns
756 internal_ns = self.shell.internal_ns
@@ -769,7 +788,26 b' Currently the magic system has the following functions:\\n"""'
769 file and things which are internal to IPython.
788 file and things which are internal to IPython.
770
789
771 This is deliberate, as typically you may load many modules and the
790 This is deliberate, as typically you may load many modules and the
772 purpose of %who is to show you only what you've manually defined."""
791 purpose of %who is to show you only what you've manually defined.
792
793 Examples
794 --------
795
796 Define two variables and list them with who::
797
798 In [1]: alpha = 123
799
800 In [2]: beta = 'test'
801
802 In [3]: %who
803 alpha beta
804
805 In [4]: %who int
806 alpha
807
808 In [5]: %who str
809 beta
810 """
773
811
774 varlist = self.magic_who_ls(parameter_s)
812 varlist = self.magic_who_ls(parameter_s)
775 if not varlist:
813 if not varlist:
@@ -802,7 +840,23 b' Currently the magic system has the following functions:\\n"""'
802 elements, typecode and size in memory.
840 elements, typecode and size in memory.
803
841
804 - Everything else: a string representation, snipping their middle if
842 - Everything else: a string representation, snipping their middle if
805 too long."""
843 too long.
844
845 Examples
846 --------
847
848 Define two variables and list them with whos::
849
850 In [1]: alpha = 123
851
852 In [2]: beta = 'test'
853
854 In [3]: %whos
855 Variable Type Data/Info
856 --------------------------------
857 alpha int 123
858 beta str test
859 """
806
860
807 varnames = self.magic_who_ls(parameter_s)
861 varnames = self.magic_who_ls(parameter_s)
808 if not varnames:
862 if not varnames:
General Comments 0
You need to be logged in to leave comments. Login now