[Python-ideas] Adding some standalone iterator/sequence functions as methods of the iterator objects

Manuel Alejandro Cerón Estrada ceronman at gmail.com
Wed Aug 12 22:48:29 CEST 2009


Hello again.

El 12 de agosto de 2009 15:12, Guido van Rossum<guido at python.org> escribió:
> That idea has also been considered and rejected, because of Python's
> commitment to duck typing.
>
> Really, please find the old discussion and read it rather than
> rehashing old broken ideas.

Sorry for getting back already discussed ideas. Finding old
discussions can be very hard since the Python mailing lists have
thousands of mails and some time you just don't use the correct
keywords while searching.

I understand why this has been rejected. However, I still think that
the core idea of making the pipe-filter pattern and queries more
readable is valuable.

I'm thinking on implementing this as a third party wrapper module for
itertools and others. An QueryIter wrapper class could help to this
purpose and It would be very easy to implement. Could be something
like this:

pairs_tasks = IterQuery(programmers).combinations(2).cycle().izip(tasks)

Methods would be simple wrappers:

def combinations(self, repeat):
    return IterQuery(itertools.combinations(self, repeat))

Manuel.

-- 
Manuel Alejandro Cerón Estrada
http://ceronman.freaks-unidos.net



More information about the Python-ideas mailing list