[Python-ideas] Integrate some itertools into the Python syntax

Michael Selik mike at selik.org
Wed Mar 23 13:13:58 EDT 2016


> On Mar 23, 2016, at 6:37 AM, Chris Angelico <rosuav at gmail.com> wrote:
> 
> On Wed, Mar 23, 2016 at 9:04 PM, Michel Desmoulin
> <desmoulinmichel at gmail.com> wrote:
>>> (Whether or not to make slice notation usable outside subscript
>>> operations could then be tackled as an independent question)
>>> 
>>> For itertools.chain, it may make sense to simply promote it to the builtins.
>> 
>> Same problem as with new keywords : it can be a problem with people
>> using chain as a var name.
>> 
> 
> Less of a problem though - it'd only be an issue for people who (a)
> use chain as a var name, and (b) want to use the new shorthand. Their
> code will continue to work identically with itertools.chain (or not
> using it at all). With a new keyword, their code would instantly fail.

I enjoy using ``chain`` as a variable name. It has many meanings outside of iteration tools. Three cheers for namespaces.

Many of Python 3’s changes versus Python 2 were to take the pure stance -- change special statement syntax to function calls, move a few builtins into appropriate modules. If chain were a builtin, we’d have someone suggesting it move into itertools.


More information about the Python-ideas mailing list