Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #80848 > unrolled thread

Re: Where is inspect() located?

Started byChris Angelico <rosuav@gmail.com>
First post2014-11-16 15:29 +1100
Last post2014-11-16 15:29 +1100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Where is inspect() located? Chris Angelico <rosuav@gmail.com> - 2014-11-16 15:29 +1100

#80848 — Re: Where is inspect() located?

FromChris Angelico <rosuav@gmail.com>
Date2014-11-16 15:29 +1100
SubjectRe: Where is inspect() located?
Message-ID<mailman.15864.1416112165.18130.python-list@python.org>
On Sun, Nov 16, 2014 at 3:12 PM, Igor Korot <ikorot01@gmail.com> wrote:
> In the https://docs.python.org/2/library/inspect.html, it says it is
> located in Lib/inspect.py.
>
> What am I missing? Or its only for 3.x?

You need to import it. If you're curious, you can find out exactly
where it's imported from like this:

Python 2.7.3 (default, Mar 13 2014, 11:03:55)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import inspect
>>> inspect.__file__
'/usr/lib/python2.7/inspect.pyc'

The path will be different on your system, as this is a Debian box,
but the technique is the same. However, all that matters is that you
hadn't imported it. The Lib directory is one of the places where
importable modules are found.

ChrisA

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web