Want more features on Pastebin? Sign Up, it's FREE!
Guest

broken ipython session 3.2.1

By: a guest on Aug 11th, 2011  |  syntax: None  |  size: 1.66 KB  |  views: 54  |  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 3.2.1 (v3.2.1:ac1f7e5c0510, Jul  9 2011, 01:03:53)
  2. [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
  3. Type "help", "copyright", "credits" or "license" for more information.
  4. Python 3.2.1 (v3.2.1:ac1f7e5c0510, Jul  9 2011, 01:03:53)
  5. Type "copyright", "credits" or "license" for more information.
  6.  
  7. IPython 0.11 -- An enhanced Interactive Python.
  8. ?         -> Introduction and overview of IPython's features.
  9. %quickref -> Quick reference.
  10. help      -> Python's own help system.
  11. object?   -> Details about 'object', use 'object??' for extra details.
  12.  
  13. In [1]: from time import sleep
  14.  
  15. In [2]: def sleep2(time):
  16.    ...:     def sleep3():
  17.    ...:         sleep(time)
  18.    ...:         return time
  19.    ...:     return sleep3
  20.    ...:
  21.  
  22. In [3]: sleep2(2)
  23. Out[3]: <function __main__.sleep3>
  24.  
  25. In [4]: sleep2(2)()
  26. ---------------------------------------------------------------------------
  27. NameError                                 Traceback (most recent call last)
  28. /Users/maarten/.pystartup in <module>()
  29. ----> 1 sleep2(2)()
  30.  
  31. /Users/maarten/.pystartup in sleep3()
  32.       1 def sleep2(time):
  33.       2     def sleep3():
  34. ----> 3         sleep(time)
  35.       4         return time
  36.       5     return sleep3
  37.  
  38. NameError: global name 'sleep' is not defined
  39.  
  40. In [5]: [sleep2(i) for i in range(1,5)]
  41. ---------------------------------------------------------------------------
  42. NameError                                 Traceback (most recent call last)
  43. /Users/maarten/.pystartup in <module>()
  44. ----> 1 [sleep2(i) for i in range(1,5)]
  45.  
  46. /Users/maarten/.pystartup in <listcomp>(.0)
  47. ----> 1 [sleep2(i) for i in range(1,5)]
  48.  
  49. NameError: global name 'sleep2' is not defined
  50.  
  51. In [6]:
clone this paste RAW Paste Data