[Python-ideas] sequence.apply(function)

Antoine Pitrou solipsis at pitrou.net
Sun Sep 2 00:02:11 CEST 2012


On Sun, 2 Sep 2012 00:55:39 +0300
Yuval Greenfield <ubershmekel at gmail.com>
wrote:
> On Sat, Sep 1, 2012 at 8:06 PM, Guido van Rossum <guido at python.org> wrote:
> 
> > It's less Pythonic, because every sequence-like type (not just list)
> > would have to reimplement it.
> >
> > Similar things get proposed for iterators (e.g. it1 + it2, it[:n],
> > it[n:]) regularly and they are (and should be) rejected for the same
> > reason.
> >
> >
> Python causes some confusion because some things are methods and others
> builtins. Is there a PEP or rationale that defines what goes where?

When something only applies to a single type or a couple of types, it is
a method. When it is generic enough, it is a builtin.
Of course there are grey areas but that's the basic idea.

Regards

Antoine.


-- 
Software development and contracting: http://pro.pitrou.net





More information about the Python-ideas mailing list