[Python-Dev] PEP 3000 and iterators
James Y Knight
foom at fuhm.net
Sun Sep 11 05:57:58 CEST 2005
More information about the Python-Dev mailing list
Sun Sep 11 05:57:58 CEST 2005
- Previous message: [Python-Dev] PEP 3000 and iterators
- Next message: [Python-Dev] PEP 3000 and iterators
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Sep 10, 2005, at 6:07 PM, Lisandro Dalcin wrote: > 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? > No, that cannot work. However, there is a very obvious and trivial solution. Do not remove dict.iteritems in Py 3.0. Py2.X programs wishing forward compat can avoid dict.items and use instead dict.iteritems. In Py3.0, dict.items becomes a synonym for dict.iteritems and programs that don't care about compat with 2.X can just use dict.items from then on. And everybody can be happy. A small number of redundant methods is a small price to pay for compatibility. James
- Previous message: [Python-Dev] PEP 3000 and iterators
- Next message: [Python-Dev] PEP 3000 and iterators
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list