[Python-Dev] Re: Dynamic nested scopes

Thomas Wouters thomas@xs4all.net
Fri, 3 Nov 2000 17:12:04 +0100


On Fri, Nov 03, 2000 at 10:36:22AM -0500, Guido van Rossum wrote:
> [Barry]

> > Would this [replacing builtins] be illegal?

> 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().

Eep. I don't care much about scoping, so I'm not going to say much about
that, but I certainly do care about Python's flexibility. One of the great
things is that there are so little special cases, that (nearly) everything
is delightfully consistent. Being able to override open() but not hash() or
range() sounds directly contrary to that, at least to me. Being able to
change __builtins__ *just like any other dict* strikes me as terribly
Pythonic, though I realize this is probably contrary to Guido's view of
Python :-) It also makes for instance 'exec' and 'eval' terribly obvious.

I understand where the wish to restrict replacement and shadowing of
builtins comes from, but I'm hoping here that this is going to be
'optional', like Perl's -w and 'use strict'. Defaulting to maximum
simplicity and maximum flexibility (in that order:) but with optional
warnings (when shadowing/modifying a builtin) and optimizations (using
constants for builtins, when not modifying or shadowing them, for instance.)

Just-my-fl.0,04-ly y'rs,
-- 
Thomas Wouters <thomas@xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!