Message174120
I saw there is the same lack of clarity in the doc of `inspect.getsource()`:
>>> import inspect
>>> print(inspect.getsource.__doc__)
Return the text of the source code for an object.
The argument may be a module, class, method, function, traceback, frame,
or code object. The source code is returned as a single string. An
IOError is raised if the source code cannot be retrieved.
>>> def foo():
... pass
...
>>> inspect.getsource(foo)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.3/inspect.py", line 726, in getsource
lines, lnum = getsourcelines(object)
File "/usr/local/lib/python3.3/inspect.py", line 715, in getsourcelines
lines, lnum = findsource(object)
File "/usr/local/lib/python3.3/inspect.py", line 563, in findsource
raise IOError('could not get source code')
OSError: could not get source code |
|
Date |
User |
Action |
Args |
2012-10-29 15:19:17 | marco.buttu | set | recipients:
+ marco.buttu, ezio.melotti, r.david.murray, docs@python |
2012-10-29 15:19:17 | marco.buttu | set | messageid: <1351523957.42.0.744095565727.issue16355@psf.upfronthosting.co.za> |
2012-10-29 15:19:17 | marco.buttu | link | issue16355 messages |
2012-10-29 15:19:17 | marco.buttu | create | |
|