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

Eric Eisner ede at mit.edu
Thu Aug 13 03:25:24 CEST 2009

2009/8/13 Manuel Alejandro Cerón Estrada <ceronman at gmail.com>:
> Using current functions:
> pairs_tasks = itertools.izip(itertools.cycle(itertools.combinations(programmers,
> 2)), tasks)
> Using methods:
> pars_tasks = programmers.combinations(2).cycle().izip(tasks)

As an aside, I've always thought that Python tends to use functions
because Guido's native language is a head-initial language, where the
action precedes the object. On the other hand, Ruby tends to use
methods because its creator, Yukihiro Matsumoto, speaks a head-final
language, where the object preceds the action.

So in conclusion, functions are more pythonic.


More information about the Python-ideas mailing list