[Python-Dev] Re: Dynamic nested scopes

Guido van Rossum guido@python.org
Fri, 03 Nov 2000 10:36:22 -0500

> I'm a little confused.  I've occasionally done the following within an
> application:
> ----------driver.py
> # need to override built-in open() to do extra debugging
> def debuggin_open(filename, mode, bufsize):
>     # ...
>     import __builtin__.__dict__['open'] = debugging_open
> -------------------- snip snip --------------------
> Would this be illegal?  Would other modules in my application (even if
> imported from the standard library!) automatically get
> debugging_open() for open() like they do now?

That's up for discussion.  Note that the open() function is special in
this respect -- I don't see you doing the same to range() or hash().

If this is deemed a useful feature (for open()), we can make a rule
about which built-ins you cannot override like this and which ones you

--Guido van Rossum (home page: http://www.python.org/~guido/)