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


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

Re: __missing__ for the top-level Python script

Started byChris Angelico <rosuav@gmail.com>
First post2014-11-13 01:37 +1100
Last post2014-11-13 01:37 +1100
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: __missing__ for the top-level Python script Chris Angelico <rosuav@gmail.com> - 2014-11-13 01:37 +1100

#80606 — Re: __missing__ for the top-level Python script

FromChris Angelico <rosuav@gmail.com>
Date2014-11-13 01:37 +1100
SubjectRe: __missing__ for the top-level Python script
Message-ID<mailman.15722.1415803041.18130.python-list@python.org>
On Mon, Nov 10, 2014 at 10:31 AM, Chris Angelico <rosuav@gmail.com> wrote:
> So the semantics should be: If NameError would be raised (not
> including UnboundLocalError, which still represents an error), attempt
> to import the absent name. If successful, continue as if it had
> already been done. If ImportError is raised, suppress it and let the
> original NameError happen.

No bites? I'd have thought there'd be a few crazy ideas thrown out in
answer to this.

What if it's worded as a feature for interactive Python? Save you the
trouble of explicitly importing modules, by auto-importing them in
response to usage. In theory, it's as simple as adding __missing__ to
globals(), but I don't know of a way to do that for the main module.

ChrisA

[toc] | [standalone]


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


csiph-web