It still an import in every file you want to use it, and in the shell. We can already have 3rd party lib to do this, so no need to change Python for that. Le 22/03/2016 16:29, Steve Dower a écrit :
What if itertools.iter was added with the expanded semantics? Possibly even a new name, but similar use to the built-in func.
Top-posted from my Windows Phone ------------------------------------------------------------------------ From: Chris Angelico mailto:rosuav@gmail.com Sent: 3/22/2016 6:06 Cc: python-ideas mailto:python-ideas@python.org Subject: Re: [Python-ideas] Integrate some itertools into the Python syntax
On Tue, Mar 22, 2016 at 11:58 PM, Michel Desmoulin
wrote: E.G: I suggested before that iter() returns objects with advanced semantics for [:] as an alternative to add slicing to generators.
The builtin iter() function simply returns whatever __iter__() returns. I've offered a way for you to easily shadow the builtin with your own class (which can then provide whatever it likes), but it's going to have to work by wrapping the original iterator, which will break generators (unless you explicitly pass everything through, and even then you'll break things that check if isinstance(x, generator), because you can't subclass generator).
ChrisA _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/