Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- C:\Documents and Settings\bgbg\My Documents\Python>ipython
- Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)]
- Type "copyright", "credits" or "license" for more information.
- IPython 0.10 -- An enhanced Interactive Python.
- ? -> Introduction and overview of IPython's features.
- %quickref -> Quick reference.
- help -> Python's own help system.
- object? -> Details about 'object'. ?object also works, ?? prints more.
- In [2]: %cpaste
- Pasting code; enter '--' alone on the line to stop.
- :class C:
- : def __init__(self):
- : self.N = 100
- : pass
- :
- : def f(self, param):
- : print 'C.f -- param'
- : for k in xrange(param):
- : for i in xrange(self.N):
- : for j in xrange(self.N):
- : a = float(i)/(1+float(j)) + float(i/self.N) ** float(j/self.N)
- :
- :import cProfile
- :
- :c = C()
- :cProfile.run('c.f(3)')
- :--
- 2 function calls in 0.000 CPU seconds
- Ordered by: standard name
- ncalls tottime percall cumtime percall filename:lineno(function)
- 1 0.000 0.000 0.000 0.000 <string>:1(<module>)
- 1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
- ---------------------------------------------------------------------------
- NameError Traceback (most recent call last)
- C:\Documents and Settings\boris\My Documents\Python\<ipython console> in <module>()
- C:\Python25\lib\site-packages\IPython\iplib.pyc in ipmagic(self, arg_s)
- 1180 else:
- 1181 magic_args = self.var_expand(magic_args,1)
- -> 1182 return fn(magic_args)
- 1183
- 1184 def ipalias(self,arg_s):
- C:\Python25\lib\site-packages\IPython\Magic.pyc in magic_cpaste(self, parameter_s)
- 3364 self._get_pasted_lines(sentinel))
- 3365
- -> 3366 self._execute_block(block, par)
- 3367
- 3368 def magic_paste(self, parameter_s=''):
- C:\Python25\lib\site-packages\IPython\Magic.pyc in _execute_block(self, block, par)
- 3317 b = textwrap.dedent(block)
- 3318 self.user_ns['pasted_block'] = b
- -> 3319 exec b in self.user_ns
- 3320 else:
- 3321 self.user_ns[par] = SList(block.splitlines())
- C:\Documents and Settings\boris\My Documents\Python\<string> in <module>()
- C:\Python25\lib\cProfile.pyc in run(statement, filename, sort)
- 27 try:
- 28 try:
- ---> 29 prof = prof.run(statement)
- 30 except SystemExit:
- 31 pass
- C:\Python25\lib\cProfile.pyc in run(self, cmd)
- 133 import __main__
- 134 dict = __main__.__dict__
- --> 135 return self.runctx(cmd, dict, dict)
- 136
- 137 def runctx(self, cmd, globals, locals):
- C:\Python25\lib\cProfile.pyc in runctx(self, cmd, globals, locals)
- 138 self.enable()
- 139 try:
- --> 140 exec cmd in globals, locals
- 141 finally:
- 142 self.disable()
- C:\Python25\lib\site-packages\IPython\FakeModule.pyc in <module>()
- NameError: name 'c' is not defined
- In [3]:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement