Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

working ipython session 2.6.1

By: a guest on Aug 11th, 2011  |  syntax: None  |  size: 0.81 KB  |  views: 96  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49)
  2. Type "copyright", "credits" or "license" for more information.
  3.  
  4. IPython 0.11 -- An enhanced Interactive Python.
  5. ?         -> Introduction and overview of IPython's features.
  6. %quickref -> Quick reference.
  7. help      -> Python's own help system.
  8. object?   -> Details about 'object', use 'object??' for extra details.
  9.  
  10. In [1]: from time import sleep
  11.  
  12. In [2]: def sleep2(time):
  13.    ...:     def sleep3():
  14.    ...:         sleep(time)
  15.    ...:         return time
  16.    ...:     return sleep3
  17.    ...:
  18.  
  19. In [3]: sleep2(2)
  20. Out[3]: <function __main__.sleep3>
  21.  
  22. In [4]: sleep2(2)()
  23. Out[4]: 2
  24.  
  25. In [5]: [sleep2(i) for i in range(1,5)]
  26. Out[5]:
  27. [<function __main__.sleep3>,
  28.  <function __main__.sleep3>,
  29.  <function __main__.sleep3>,
  30.  <function __main__.sleep3>]
  31.  
  32. In [6]: