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


Groups > comp.lang.python > #80848

Re: Where is inspect() located?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.053
X-Spam-Evidence '*H*': 0.89; '*S*': 0.00; '16,': 0.03; 'imported': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; '2.7.3': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'igor': 0.16; 'missing?': 0.16; 'wrote:': 0.18; "skip:' 30": 0.19; '>>>': 0.22; 'import': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'this:': 0.26; 'header:In-Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; 'inspect': 0.31; 'says': 0.33; 'url:python': 0.33; 'but': 0.35; 'received:google.com': 0.35; 'located': 0.36; 'found.': 0.36; 'subject:?': 0.36; 'url:org': 0.36; 'system,': 0.38; 'nov': 0.38; 'same.': 0.38; 'url:library': 0.38; 'pm,': 0.38; "you're": 0.61; 'box,': 0.64; 'places': 0.64; 'more': 0.64; 'different': 0.65; 'mar': 0.68; '2014,': 0.84; 'subject:Where': 0.84; 'to:none': 0.92; 'technique': 0.93
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=6OorMZpI67E1+dOGHNdNMWNmDFAxOLp7sUr0e5GvZLQ=; b=heeg9sd6OpufYpZqgvkRbKzPUovnXnUvo1Bx2OixOMfw8YG3BVl82ejW8liIKhDOfl 5yPjGZILr2JpeKrSAuBIWE0q/v0/M7zv4DyArQfVUpcpylVAhlrrZ6tvHFqgqOLvgBkj gHW2SHf2gvLPeR6dVW+cvx/gCNLt+LUYoBG1vOvWJeRxTKtNd1K2/dzAMBNe8vCVLD+f MAQ0pGGxdwg7btw5LMvijXW5rXzOLKKoBiUCuScxrk0T0d52Ha8VXBOBtMFKMgGJvIkh 7k7hJmQPj0DlzS6liNkQVV1YL9e9ucnfqin3th++RRd+yGtqKI0POBq879OBRDVw4OX4 tTvg==
MIME-Version 1.0
X-Received by 10.107.165.19 with SMTP id o19mr21125516ioe.1.1416112162493; Sat, 15 Nov 2014 20:29:22 -0800 (PST)
In-Reply-To <CA+FnnTw0+kB2AJmUKK9o_WO18TxA5E52L4UgDRo=LnYQcmOkoQ@mail.gmail.com>
References <CA+FnnTw0+kB2AJmUKK9o_WO18TxA5E52L4UgDRo=LnYQcmOkoQ@mail.gmail.com>
Date Sun, 16 Nov 2014 15:29:22 +1100
Subject Re: Where is inspect() located?
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.15864.1416112165.18130.python-list@python.org> (permalink)
Lines 22
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1416112165 news.xs4all.nl 2884 [2001:888:2000:d::a6]:40482
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:80848

Show key headers only | View raw


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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web