Single type for __builtins__ in Py3.0
Tom Anderson
twic at urchin.earth.li
Fri Sep 23 14:10:57 EDT 2005
On Fri, 23 Sep 2005, Collin Winter wrote:
> If possible, I'd like to see this go in before 3.0. The reference manual
> currently states [2] that __builtins__ can be either a dict or a module,
> so changing it to always be a module would still be in keeping with
> this. However, I realise that there's probably code out there that
> hasn't been written to deal with both types, so this would result in
> some minor breakage (though it would be easily fixable).
Perhaps __builtins__ should be a magic module which could be accessed
using subscripting as well as proper names (__builtins__["int"] as well as
__builtins__.int), to avoid breakage. AFAICT, there's no easy way to do
this at the moment: defining __getitem__ in a module doesn't give you a
working [] operator on it. Have i screwed that up? If not, might it be
possible to change this, so modules are treated the same as any other
object in terms of handling []? I admit that this is the only use case for
it, and it's a pretty weak one, but it would be good to be consistent, i
think.
> If this gets a good response, I'll kick it up to python-dev.
+1
tom
--
Gatsos are a stealth tax on motorists in the same way that city centre video cameras are a stealth tax on muggers and DNA testing is a stealth tax on rapists. -- Guy Chapman
More information about the Python-list
mailing list