DO NOT USE! THIS IS AMBIGUOUS. You might be looking for [web-inspector].
Questions tagged [inspect]
610 questions
3
votes
2 answers
python inspect.getsource gets the wrong source
Running this file foo.py
import inspect
class Parent(object):
def source1(self):
class A(object):
def foo(self):
pass
print inspect.getsource(A)
def source2(self):
class A(object):
…

iffy
- 719
- 1
- 4
- 20
3
votes
1 answer
Way to inspect element and see the PHP page it's on?
Is there a way to inspect an element and see the PHP page (template file) that element is coming from?
For example, using Google Chrome's developer tools I can see which .CSS page any element is using. I'd like to do the same to quickly find the…

Michael Romrell
- 1,026
- 5
- 15
- 31
3
votes
2 answers
inspect.isfunction doesn't work for all modules?
I'm attempting to use the answer to Is it possible to list all functions in a module? to list functions in a range of modules. But in my interpreter I get as follows:
Python 3.3.2 (v3.3.2:d047928ae3f6, May 16 2013, 00:03:43) [MSC v.1600 32 bit…

user2979044
- 306
- 4
- 14
3
votes
1 answer
Is there a python equivalent to the ruby inspect method?
In ruby you can inspect any object with the inspect method:
For example:
print [1,"string",:symbol,[?l, ?i, ?s, ?t]].inspect
will print
[1, "string", :symbol, ["l", "i", "s", "t"]]
Is there any similar facility in python which allows me to print…

michas
- 25,361
- 15
- 76
- 121
3
votes
1 answer
See What Line a Function Was Called From in Python Decorator
Given something like this:
@my_decorator
my_function(some, args)
Is it possible for my_decorator to discover the file and line number my_function was called from?
Thanks

russell_h
- 956
- 2
- 9
- 18
3
votes
3 answers
What is the equivalent of str (R language) in javascript, to get the structure of an object?
In R , we have the handy function str to inspect object that tells you the structure of an object.
Here an example used to get the structure of a parsed json object ( I am using json just to give a useful example)
txt =…

agstudy
- 119,832
- 17
- 199
- 261
3
votes
2 answers
Is there a way to use INSPECT TALLYING with a check for multiple characters?
I have a string for which I wish to tally the count of characters till a certain pattern of characters is found.
For example:
Give a string: askabanskarkartikrockstar
I would like to know how many characters are there before the kartik in the…

ikartik90
- 2,695
- 6
- 26
- 38
3
votes
1 answer
outline node on hover
Here is an example of outlining a div on hover.
However I am trying to emulate something like chrome inspector/firebug where the user can select a DOM node by mouseover and clicking on an element.
http://jsfiddle.net/Xuddz/57/
However, I don't want…

ejang
- 3,982
- 8
- 44
- 70
3
votes
2 answers
inspect.getmodule's result change after os.chdir
Some code of mine sprung a bug seemingly out of nowhere. When I tracked it down, I found that evaluating inspect.getmodule with the same (identical) argument before and after executing os.chdir gives different results.
(FWIW, I'm running Python…

kjo
- 33,683
- 52
- 148
- 265
3
votes
2 answers
Python - How can I query the class in which a method is defined?
My question is somewhat similar to this one; it concerns object methods rather than module contents. I want to know if I can use the inspect module to get the methods defined only in the class I'm asking about, and not its parent(s).
I need this…

Benjamin Hodgson
- 42,952
- 15
- 108
- 157
3
votes
2 answers
Listing builtin functions and methods (Python)
I have came up with this:
[a for a in dir(__builtins__) if str(type(getattr(__builtins__,a))) == ""]
I know its ugly. Can you show me a better/more pythonic way of doing this?
idontreg
3
votes
1 answer
Is there a way to retrieve source code from a live Python interpreter session or a dynamically created object?
When a Python object is created dynamically, either in a live interpreter session, by un-marshalling a pickled object or some other way, the inspect module can no longer be used to retrieve its source code (as inspect relies on the idea that the…

snim2
- 4,004
- 27
- 44
3
votes
3 answers
Using chrome for web development - how to dock the inspector?
I know Firebug is the standard, but I find myself using Chrome a lot (screen space, speed, etc.) Anyway, I think their inspector is pretty good, too. Certainly good enough that I don't want to fire up FF and navigate thru a site every time that I…

Keith Bentrup
- 11,834
- 7
- 49
- 56
3
votes
3 answers
How to solve the `Object doesn't support #inspect` error?
I am using rails v3.2.2 and I get a strange error when I try to load associated records.
The following is the Terminal input/output I get:
1.9.2-p318 :011 > Category.first
=> #
1.9.2-p318 :013 > Category.first.articles
…

Backo
- 18,291
- 27
- 103
- 170
2
votes
2 answers
Inspect SWT app at runtime?
Is there any way to inspect (in a broad sense, to get any info) a SWT app without disassembling it (as it's packed as exe and I don't know how to extract it first)?
EDIT: turns out the app is a SWT one.

yanchenko
- 56,576
- 33
- 147
- 165