Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #44517
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <peter@pelican.ucsd.edu> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.027 |
| X-Spam-Evidence | '*H*': 0.95; '*S*': 0.00; 'say,': 0.05; 'startup': 0.05; 'error:': 0.07; 'imported': 0.09; 'subject:module': 0.09; 'python': 0.11; 'numpy': 0.16; 'fix': 0.17; 'module': 0.19; 'file.': 0.24; 'point': 0.28; 'question:': 0.31; 'received:132': 0.31; 'trivial': 0.31; 'file': 0.32; 'but': 0.35; 'there': 0.35; 'skip:> 10': 0.36; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'called': 0.40; 'header:Message-Id:1': 0.63; 'name': 0.63; 'to,': 0.72; '.....': 0.78; 'subject:Mystery': 0.84; 'from:addr:peter': 0.91 |
| X-IronPort-Anti-Spam-Filtered | true |
| X-IronPort-Anti-Spam-Result | AnELANTJflGJbvOE/2dsb2JhbABSgwcBNYJwqXMBinCHeRZ0g1s0iHeeNZdshzqPN4M5A4kSjzKQBIMxHA |
| X-IronPort-AV | E=Sophos;i="4.87,575,1363158000"; d="scan'208";a="1030234475" |
| X-Spam-Status | No |
| X-Spam-Level | |
| Date | Mon, 29 Apr 2013 12:30:29 -0700 (PDT) |
| From | Peter Rowat <peter@pelican.ucsd.edu> |
| To | python-list@python.org |
| Subject | Mystery of module bindings! |
| 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 | <http://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 | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1161.1367263904.3114.python-list@python.org> (permalink) |
| Lines | 24 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1367263904 news.xs4all.nl 15939 [2001:888:2000:d::a6]:51477 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:44517 |
Show key headers only | View raw
This must be a trivial question: I have "import numpy as np" in the python startup file. A file called mod1.py contains "def myfn..." and inside myfn there is a call to, say, "np.convolve". Interactively: >python .... (numpy imported as np) >import mod1 > >mod1.myfn(...) Error: global name "np" is not known. ======= Why is "np" not known to functions in an imported module ? ======= I can fix this by including "import numpy as np" in any module that uses numpy functions -- but then what is the point of having a startup file? -- PeterR
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Mystery of module bindings! Peter Rowat <peter@pelican.ucsd.edu> - 2013-04-29 12:30 -0700 Re: Mystery of module bindings! Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-04-29 19:49 +0000
csiph-web