[Python-3000] Set literals - another try
jimjjewett at gmail.com
Wed Aug 9 18:36:24 CEST 2006
On 8/9/06, Nick Coghlan <ncoghlan at gmail.com> wrote:
> A different way to enable that would be to include a set of non-keyword names
> (a subset of the default builtin namespace) in the language definition that
> the compiler is explicitly permitted to treat as constants if they are not
> otherwise defined in the current lexical scope.
Realistically, I want my own functions and class definitions to be
treated that way (inlinable) most of the time. I don't want to start
marking them with "stable".
> The only thing that would break is hacks like poking an alternate
> implementation of str or set or len into the global namespace from somewhere
> outside the module.
So what we need is a module that either rejects changes (after it is
sealed) or at least provides notification (so things can be
recompiled). In theory, this could even go into python 2.x (though
not as the default), though it is a bit difficult in practice. (By
the time you can specify an alternative dict factory, it is too late.)
More information about the Python-3000