Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #44029 > unrolled thread

Re: suggestion for a small addition to the Python 3 list class

Started byTerry Jan Reedy <tjreedy@udel.edu>
First post2013-04-21 21:44 -0400
Last post2013-04-21 21:44 -0400
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: suggestion for a small addition to the Python 3 list class Terry Jan Reedy <tjreedy@udel.edu> - 2013-04-21 21:44 -0400

#44029 — Re: suggestion for a small addition to the Python 3 list class

FromTerry Jan Reedy <tjreedy@udel.edu>
Date2013-04-21 21:44 -0400
SubjectRe: suggestion for a small addition to the Python 3 list class
Message-ID<mailman.894.1366595053.3114.python-list@python.org>
On 4/21/2013 1:12 PM, Lele Gaifax wrote:
> "Robert Yacobellis" <ryacobellis@luc.edu> writes:
>
>> I've noticed that the str join() method takes an iterable,

Specifically, it takes an iterable of strings. Any iterable can be made 
such iwth map(str, iterable) or map(repr, iterble).

 >> so in the
>> most general case I'm suggesting to add a join() method to every
>> Python-provided iterable (however, for split() vs. join()

.split *could* have been changed in 3.0 to return an iterator rather 
than a list, as done with map, filter, and others. An itersplit method 
*might* be added in the future.

  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...)

Plus, only lists of strings can be joined, not generic lists.


> 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.
>

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web