Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #71906
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news2.arglkargh.de!news.mixmin.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.006 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; '22,': 0.09; 'inserted': 0.09; 'subject:script': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; '2.7': 0.14; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'subject:import': 0.16; 'xavier': 0.16; 'wrote:': 0.18; 'thu,': 0.19; 'import': 0.22; 'cc:addr:python.org': 0.22; 'simpler': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; '>>>>': 0.31; 'skip:m 30': 0.32; 'received:google.com': 0.35; 'pm,': 0.38; 'imp': 0.84; 'subject:All': 0.84; 'to:none': 0.92 |
| 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=NUwbCl2xskYXfZMjVZKnGiHeJtxSAFkIwmw8NlzRVWo=; b=e4G/dYcRg5kvuX1g5nzVo1vbnZRY6qrki6hr7l/Tnsc5G0FiZT6D1gySpYlf+hMawu X5rwzGxS4ggnio4s7qtUcWgIZhumKOmw2YyjfNbBBM1eDsB1x+vaZZ32nW0XrzdV4KZ/ 5G2E5K8I2rUC3Jmury792AbuNKbG/vF51Ac80Je7fD366QvBm3ay7FKPHRNgKLfL3Oem k/6SDT+PJWD8TqAUnEYgTj4ZczsLTGISjnlm/o7fkbR0JWoTarocz9VamQYz7amDQKhL Dt9ngqQmMnxl5HQdqWZIPYRMbCFOjXMGBvDecmWUcQLN69Sw//UUQb7KaC49D6qqcvVP zwnw== |
| MIME-Version | 1.0 |
| X-Received | by 10.220.205.3 with SMTP id fo3mr1745448vcb.57.1400780653419; Thu, 22 May 2014 10:44:13 -0700 (PDT) |
| In-Reply-To | <537DD23C.1090301@gmail.com> |
| References | <CAPTjJmoadqpS0O-15We7xi7SzFCVxTFe1TU8hConcGZzxTRdcA@mail.gmail.com> <537DD23C.1090301@gmail.com> |
| Date | Fri, 23 May 2014 03:44:13 +1000 |
| Subject | Re: All-numeric script names and import |
| 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.10230.1400781085.18130.python-list@python.org> (permalink) |
| Lines | 12 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1400781085 news.xs4all.nl 2885 [2001:888:2000:d::a6]:35950 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:71906 |
Show key headers only | View raw
On Thu, May 22, 2014 at 8:32 PM, Xavier de Gaye <xdegaye@gmail.com> wrote:
> import 1.py as module_1 on Python 2.7 (module_1 is not inserted in
> sys.modules):
>
>>>> import imp
>>>> module_1 = imp.new_module('module_1')
>>>> execfile('1.py', module_1.__dict__)
>>>> del module_1.__dict__['__builtins__']
Heh, I think __import__() is simpler than that :)
ChrisA
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: All-numeric script names and import Chris Angelico <rosuav@gmail.com> - 2014-05-23 03:44 +1000
csiph-web