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


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

Re: All-numeric script names and import

Started byChris Angelico <rosuav@gmail.com>
First post2014-05-23 03:44 +1000
Last post2014-05-23 03:44 +1000
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: All-numeric script names and import Chris Angelico <rosuav@gmail.com> - 2014-05-23 03:44 +1000

#71906 — Re: All-numeric script names and import

FromChris Angelico <rosuav@gmail.com>
Date2014-05-23 03:44 +1000
SubjectRe: All-numeric script names and import
Message-ID<mailman.10230.1400781085.18130.python-list@python.org>
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

[toc] | [standalone]


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


csiph-web