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

bgbg

By: a guest on Nov 30th, 2009  |  syntax: Python  |  size: 3.44 KB  |  views: 165  |  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.  
  2.     C:\Documents and Settings\bgbg\My Documents\Python>ipython
  3.     Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)]
  4.     Type "copyright", "credits" or "license" for more information.
  5.  
  6.     IPython 0.10 -- An enhanced Interactive Python.
  7.     ?         -> Introduction and overview of IPython's features.
  8.    %quickref -> Quick reference.
  9.    help      -> Python's own help system.
  10.     object?   -> Details about 'object'. ?object also works, ?? prints more.
  11.  
  12.     In [2]: %cpaste
  13.     Pasting code; enter '--' alone on the line to stop.
  14.     :class C:
  15.     :    def __init__(self):
  16.     :        self.N = 100
  17.     :        pass
  18.     :
  19.     :    def f(self, param):
  20.     :        print 'C.f -- param'
  21.     :        for k in xrange(param):
  22.     :            for i in xrange(self.N):
  23.     :                for j in xrange(self.N):
  24.     :                    a = float(i)/(1+float(j)) + float(i/self.N) ** float(j/self.N)
  25.     :
  26.     :import cProfile
  27.     :
  28.     :c = C()
  29.     :cProfile.run('c.f(3)')
  30.     :--
  31.              2 function calls in 0.000 CPU seconds
  32.  
  33.        Ordered by: standard name
  34.  
  35.        ncalls  tottime  percall  cumtime  percall filename:lineno(function)
  36.             1    0.000    0.000    0.000    0.000 <string>:1(<module>)
  37.             1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
  38.  
  39.  
  40.     ---------------------------------------------------------------------------
  41.     NameError                                 Traceback (most recent call last)
  42.  
  43.     C:\Documents and Settings\boris\My Documents\Python\<ipython console> in <module>()
  44.  
  45.     C:\Python25\lib\site-packages\IPython\iplib.pyc in ipmagic(self, arg_s)
  46.        1180         else:
  47.        1181             magic_args = self.var_expand(magic_args,1)
  48.     -> 1182             return fn(magic_args)
  49.        1183
  50.        1184     def ipalias(self,arg_s):
  51.  
  52.     C:\Python25\lib\site-packages\IPython\Magic.pyc in magic_cpaste(self, parameter_s)
  53.        3364             self._get_pasted_lines(sentinel))
  54.        3365
  55.     -> 3366         self._execute_block(block, par)
  56.        3367
  57.        3368     def magic_paste(self, parameter_s=''):
  58.  
  59.     C:\Python25\lib\site-packages\IPython\Magic.pyc in _execute_block(self, block, par)
  60.        3317             b = textwrap.dedent(block)
  61.        3318             self.user_ns['pasted_block'] = b
  62.     -> 3319             exec b in self.user_ns
  63.        3320         else:
  64.        3321             self.user_ns[par] = SList(block.splitlines())
  65.  
  66.     C:\Documents and Settings\boris\My Documents\Python\<string> in <module>()
  67.  
  68.     C:\Python25\lib\cProfile.pyc in run(statement, filename, sort)
  69.          27     try:
  70.          28         try:
  71.     ---> 29             prof = prof.run(statement)
  72.          30         except SystemExit:
  73.          31             pass
  74.  
  75.     C:\Python25\lib\cProfile.pyc in run(self, cmd)
  76.         133         import __main__
  77.         134         dict = __main__.__dict__
  78.     --> 135         return self.runctx(cmd, dict, dict)
  79.         136
  80.         137     def runctx(self, cmd, globals, locals):
  81.  
  82.     C:\Python25\lib\cProfile.pyc in runctx(self, cmd, globals, locals)
  83.         138         self.enable()
  84.         139         try:
  85.     --> 140             exec cmd in globals, locals
  86.         141         finally:
  87.         142             self.disable()
  88.  
  89.     C:\Python25\lib\site-packages\IPython\FakeModule.pyc in <module>()
  90.  
  91.     NameError: name 'c' is not defined
  92.  
  93.     In [3]: