[Python-Dev] PEP 3000 and iterators (original) (raw)
Guido van Rossum guido at python.org
Sat Sep 10 02:49:39 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 9/9/05, Lisandro Dalcin <dalcinl at gmail.com> wrote:
PEP 3000 says (http://www.python.org/peps/pep-3000.html) :
Core language - Return iterators instead of lists where appropriate for atomic type methods (e.g. dict.keys(), dict.values(), dict.items(), etc.) Built-in Namespace - Make built-ins return an iterator where appropriate (e.g. range(), zip(), etc.) - Relevant functions should consume iterators (e.g. min(), max()) To be removed: - xrange(): use range() instead [1] Any possibility to add one (or more) future statement to implicitly get this behavior? Any suggestion about naming?
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
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.
-- --Guido van Rossum (home page: http://www.python.org/~guido/)
- Previous message: [Python-Dev] PEP 3000 and iterators
- Next message: [Python-Dev] PEP 3000 and iterators
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]