@@ -121,6 +121,97 @@ const getExamples = (version: string = "9.8.0"): TerminalExample[] => [
121121 Out[5]: [2, 4, 6]
122122 ` ) ,
123123 } ,
124+ {
125+ name : "Object Introspection" ,
126+ lines : dedentAndSplit ( `
127+ $ ipython
128+ IPython ${ version } -- An enhanced Interactive Python
129+
130+ In [1]: import json
131+
132+ In [2]: json.dumps?
133+ Signature: json.dumps(obj, *, skipkeys=False, ensure_ascii=True, ...)
134+ Docstring: Serialize obj to a JSON formatted str.
135+
136+ In [3]: json.dumps??
137+ Source:
138+ def dumps(obj, *, skipkeys=False, ensure_ascii=True, ...):
139+ return _default_encoder.encode(obj)
140+ ` ) ,
141+ } ,
142+ {
143+ name : "History System" ,
144+ lines : dedentAndSplit ( `
145+ $ ipython
146+ IPython ${ version } -- An enhanced Interactive Python
147+
148+ In [1]: x = 42
149+
150+ In [2]: y = x * 2
151+
152+ In [3]: y
153+ Out[3]: 84
154+
155+ In [4]: _
156+ Out[4]: 84
157+
158+ In [5]: _ih[1]
159+ Out[5]: 'y = x * 2'
160+ ` ) ,
161+ } ,
162+ {
163+ name : "System Integration" ,
164+ lines : dedentAndSplit ( `
165+ $ ipython
166+ IPython ${ version } -- An enhanced Interactive Python
167+
168+ In [1]: !echo "Hello from shell"
169+ Hello from shell
170+
171+ In [2]: files = !ls *.py
172+
173+ In [3]: len(files)
174+ Out[3]: 5
175+
176+ In [4]: %cd /tmp
177+ /tmp
178+ ` ) ,
179+ } ,
180+ {
181+ name : "Magic Commands" ,
182+ lines : dedentAndSplit ( `
183+ $ ipython
184+ IPython ${ version } -- An enhanced Interactive Python
185+
186+ In [1]: def slow_func():
187+ ...: return sum(range(10000))
188+ ...:
189+
190+ In [2]: %timeit slow_func()
191+ 245 µs ± 12.3 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)
192+
193+ In [3]: %prun slow_func()
194+ 5 function calls in 0.000 seconds
195+ ` ) ,
196+ } ,
197+ {
198+ name : "Data Science" ,
199+ lines : dedentAndSplit ( `
200+ $ ipython
201+ IPython ${ version } -- An enhanced Interactive Python
202+
203+ In [1]: import pandas as pd
204+
205+ In [2]: df = pd.DataFrame({'A': [1, 2, 3], 'B': [4, 5, 6]})
206+
207+ In [3]: df.describe()
208+ Out[3]:
209+ A B
210+ count 3.000000 3.000000
211+ mean 2.000000 5.000000
212+ std 1.000000 1.000000
213+ ` ) ,
214+ } ,
124215] ;
125216
126217const EXAMPLE_DELAY = 4000 ; // Delay before starting next example
0 commit comments