##// END OF EJS Templates
Clean up some docstring formatting for interact/interactive
Thomas Kluyver -
Show More
@@ -171,7 +171,7 b' def interactive(__interact_f, **kwargs):'
171 Parameters
171 Parameters
172 ----------
172 ----------
173 __interact_f : function
173 __interact_f : function
174 The function to which the interactive widgets are tied. The **kwargs
174 The function to which the interactive widgets are tied. The `**kwargs`
175 should match the function signature.
175 should match the function signature.
176 **kwargs : various, optional
176 **kwargs : various, optional
177 An interactive widget is created for each keyword argument that is a
177 An interactive widget is created for each keyword argument that is a
@@ -246,7 +246,7 b' def interact(__interact_f=None, **kwargs):'
246 """
246 """
247 Displays interactive widgets which are tied to a function.
247 Displays interactive widgets which are tied to a function.
248 Expects the first argument to be a function. Parameters to this function are
248 Expects the first argument to be a function. Parameters to this function are
249 widget abbreviations passed in as keyword arguments (**kwargs). Can be used
249 widget abbreviations passed in as keyword arguments (`**kwargs`). Can be used
250 as a decorator (see examples).
250 as a decorator (see examples).
251
251
252 Returns
252 Returns
@@ -256,7 +256,7 b' def interact(__interact_f=None, **kwargs):'
256 Parameters
256 Parameters
257 ----------
257 ----------
258 __interact_f : function
258 __interact_f : function
259 The function to which the interactive widgets are tied. The **kwargs
259 The function to which the interactive widgets are tied. The `**kwargs`
260 should match the function signature. Passed to :func:`interactive()`
260 should match the function signature. Passed to :func:`interactive()`
261 **kwargs : various, optional
261 **kwargs : various, optional
262 An interactive widget is created for each keyword argument that is a
262 An interactive widget is created for each keyword argument that is a
@@ -264,37 +264,37 b' def interact(__interact_f=None, **kwargs):'
264
264
265 Examples
265 Examples
266 --------
266 --------
267 Renders an interactive text field that shows the greeting with the passed in
267 Render an interactive text field that shows the greeting with the passed in
268 text.
268 text::
269
269
270 1. Invocation of interact as a function
270 # 1. Using interact as a function
271 def greeting(text="World"):
271 def greeting(text="World"):
272 print "Hello {}".format(text)
272 print "Hello {}".format(text)
273 interact(greeting, text="IPython Widgets")
273 interact(greeting, text="IPython Widgets")
274
274
275 2. Invocation of interact as a decorator
275 # 2. Using interact as a decorator
276 @interact
276 @interact
277 def greeting(text="World"):
277 def greeting(text="World"):
278 print "Hello {}".format(text)
278 print "Hello {}".format(text)
279
279
280 3. Invocation of interact as a decorator with named parameters
280 # 3. Using interact as a decorator with named parameters
281 @interact(text="IPython Widgets")
281 @interact(text="IPython Widgets")
282 def greeting(text="World"):
282 def greeting(text="World"):
283 print "Hello {}".format(text)
283 print "Hello {}".format(text)
284
284
285 Renders an interactive slider widget and prints square of number.
285 Render an interactive slider widget and prints square of number::
286
286
287 1. Invocation of interact as a function
287 # 1. Using interact as a function
288 def square(num=1):
288 def square(num=1):
289 print "{} squared is {}".format(num, num*num)
289 print "{} squared is {}".format(num, num*num)
290 interact(square, num=5)
290 interact(square, num=5)
291
291
292 2. Invocation of interact as a decorator
292 # 2. Using interact as a decorator
293 @interact
293 @interact
294 def square(num=2):
294 def square(num=2):
295 print "{} squared is {}".format(num, num*num)
295 print "{} squared is {}".format(num, num*num)
296
296
297 3. Invocation of interact as a decorator with named parameters
297 # 3. Using interact as a decorator with named parameters
298 @interact(num=5)
298 @interact(num=5)
299 def square(num=2):
299 def square(num=2):
300 print "{} squared is {}".format(num, num*num)
300 print "{} squared is {}".format(num, num*num)
General Comments 0
You need to be logged in to leave comments. Login now