[Python-Dev] PEP 3000 and iterators

Lisandro Dalcin dalcinl at gmail.com
Sun Sep 11 00:07:35 CEST 2005


On 9/9/05, Guido van Rossum <guido at python.org> wrote:
> 
> For the builtins, it would actually be possible to do this by simply
> importing an alternate builtins module. Something like
> 
>   from future_builtins import min, max, zip, range
> 

Yes. A straightforward solution...

> For methods on standard objects like dicts it's not really possible
> either way; the type of a dict is determined by the module containing
> the code creating it, not the module containing the code using it.
> 

I had that in mind when I wrote my post; changing types is not the
way, that will not work. That is why I proposed __future__ (I really
do not know very well the implementation details of that feature)
because I think the parser/compiler can (magically) make the
replacements, e.g.  dict.items -> dict.iteritems for Py2.X series in
codes *using* dicts . Do you think something like this could be
implemented in a safer way?


-- 
Lisandro Dalcín
---------------
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594


More information about the Python-Dev mailing list