suggestion for a small addition to the Python 3 list class

Lele Gaifax lele at metapensiero.it
Sun Apr 21 13:12:28 EDT 2013


"Robert Yacobellis" <ryacobellis at luc.edu> writes:

> I've noticed that the str join() method takes an iterable, so in the
> most general case I'm suggesting to add a join() method to every
> Python-provided iterable (however, for split() vs. join() it would be
> sufficient to just add a join() method to the list class).

That's the reasoning behind the rejection: to be friendly enough, you'd
need to include the "join" method in the "sequence protocol", and
implement it on every "sequence-like" object (be it some kind of
UserList, or a generator, or an interator...)

This question carries several references to the various threads on the
subject: 

http://stackoverflow.com/questions/493819/python-join-why-is-it-string-joinlist-instead-of-list-joinstring

ciao, lele.
-- 
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
lele at metapensiero.it  |                 -- Fortunato Depero, 1929.




More information about the Python-list mailing list