Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #81635
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <davea@davea.name> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.003 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'explicit': 0.07; 'assuming': 0.09; 'facilitates': 0.09; 'function,': 0.09; 'here?': 0.09; 'ide': 0.09; 'line:': 0.09; 'logic': 0.09; 'windows,': 0.09; 'python': 0.11; '2.7': 0.14; 'windows': 0.15; '"from"': 0.16; "'from": 0.16; '(it': 0.16; 'before.': 0.16; 'displaying': 0.16; 'easy_install': 0.16; 'imports': 0.16; "microsoft's": 0.16; 'wrote:': 0.18; 'code.': 0.18; 'module': 0.19; 'else,': 0.19; 'written,': 0.19; 'example': 0.22; 'import': 0.22; 'header:User- Agent:1': 0.23; 'module,': 0.24; 'fairly': 0.24; "i've": 0.25; '(see': 0.26; 'equivalent': 0.26; 'mention': 0.26; 'this:': 0.26; 'gets': 0.27; 'header:In-Reply-To:1': 0.27; 'installed': 0.27; 'function': 0.29; 'am,': 0.29; 'unix': 0.29; "doesn't": 0.30; 'code': 0.31; 'probably': 0.32; 'linux': 0.33; 'running': 0.33; 'guess': 0.33; 'something': 0.35; 'but': 0.35; 'functions.': 0.36; 'like,': 0.36; "i'll": 0.36; 'subject:?': 0.36; 'should': 0.36; 'follows:': 0.38; 'somebody': 0.38; 'to:addr:python-list': 0.38; 'that,': 0.38; 'anything': 0.39; 'heard': 0.39; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'called': 0.40; 'how': 0.40; 'course.': 0.60; 'tell': 0.60; 'mentioned': 0.61; 'new': 0.61; "you're": 0.61; 'such': 0.63; 'today': 0.64; 'combining': 0.68; 'received:74.208': 0.68; 'obvious': 0.74; 'completion': 0.78; 'examples.': 0.84; 'presumably': 0.84; 'subject:Where': 0.84 |
| Date | Thu, 27 Nov 2014 10:34:51 -0500 |
| From | Dave Angel <davea@davea.name> |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: Where is path.py? |
| References | <41302A7145AC054FA7A96CFD03835A0A0B8FBD2D@EX10MBX02.EU.NEC.COM> |
| In-Reply-To | <41302A7145AC054FA7A96CFD03835A0A0B8FBD2D@EX10MBX02.EU.NEC.COM> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Provags-ID | V02:K0:FdSc5PF2539ffSvNbNutkYSsT5w06O8DCG9wVrCYYMC 7dvycimHvKKbK4XZeJZOHiOZzzyYWb9VLIgXYI0GceAjKxk1+7 lXR3eDKN2xB3M7/yWzhlkzExPgTLWFN6LqjHNCgLrCl4CBCBYk aEp6WROpAzI00+NovN+DkgaBrNHq7wnIWkE5uGyVnQeKDbQCrf KfdWCXlCudEqX94hQptM8Mr+pcjL+YYTK+Mf3MkO3wcpHnXMI5 aXVn+bkiDe0s8/h0OIYzdzVuptVRlIzdyvebaz7SGEXijwVK2x s09b3OJgaiBHrFI7o0ChK6uNoPo+PGZW3DO/S+gaO7pJPzUfPn RCC43Uvfz9S5HPsH5y98= |
| X-UI-Out-Filterresults | notjunk:1; |
| 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.16369.1417102506.18130.python-list@python.org> (permalink) |
| Lines | 69 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1417102506 news.xs4all.nl 2924 [2001:888:2000:d::a6]:37914 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:81635 |
Show key headers only | View raw
On 11/27/2014 09:10 AM, David Aldrich wrote:
> Hi
>
> I am running Python 2.7 on Windows 8.1. Today I installed path.py using easy_install:
>
> easy_install path.py
>
> The example code that I've seen imports path.py as follows:
>
> from path import path
>
> I am fairly new to Python and have a few questions about this:
>
> 1) Why is 'from path' required here?
>
The module called "path" evidently has a global symbol "path" in it.
That's unfortunate and very confusing, but it's pretty common. (See the
time function in the time module, standard library.) I don't know
anything about the module, but I'll make a wild guess that path is a
function. It doesn't matter, but it'll let me make explicit examples.
So the obvious approach to dealing with a module is to import it.
import path
At that point, to call the above mentioned function, you would need to use:
result = path.path(arguments)
That gets confusing, so you might want a shortcut:
pathfunc = path.path
and now you can use
result = pathfunc(arguments)
The "from" logic facilitates that, by combining the import with the
assignment: The line:
from path import path
is equivalent to
import path; path = path.path
I don't know where path.py is, and it might be called something else,
such as path.pyc, or path.pyd, or ... But you can probably search for
it, if you like, with something like
dir /s c:\path.p*
I am assuming you're running on Windows, because you mention a Microsoft
IDE. If you were on Linux or Unix or Mac, you'd presumably use the find
program.
>
> 2) I am using Microsoft's PTVS IDE to develop my code. It is not
displaying code completion for path.py (it works for the standard
libraries). How would I tell PTVS about path.py?
No clue about Microsoft's PTVS IDE; I hadn't heard of it before. But
if somebody else doesn't jump in, you should be able to use the Python
dir() and help() built-in functions. Then only work if the path
module is well written, of course.
--
DaveA
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Where is path.py? Dave Angel <davea@davea.name> - 2014-11-27 10:34 -0500
csiph-web