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


Groups > comp.lang.python > #44029

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

Path csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!cs.uu.nl!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.005
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'sufficient': 0.05; 'subject:Python': 0.06; 'filter,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'strings.': 0.09; '(however,': 0.16; 'class).': 0.16; 'iterable': 0.16; 'iterable)': 0.16; 'iterable,': 0.16; 'iterator': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:class': 0.16; 'wrote:': 0.18; '3.0': 0.19; 'header:User-Agent:1': 0.23; 'question': 0.24; "i've": 0.25; 'references': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'subject:list': 0.30; "i'm": 0.30; 'writes:': 0.31; 'lists': 0.32; 'noticed': 0.34; 'subject:the': 0.34; 'add': 0.35; 'done': 0.36; 'method': 0.36; 'behind': 0.37; 'list': 0.37; 'implement': 0.38; 'generic': 0.38; 'lists.': 0.38; 'others.': 0.38; 'to:addr:python-list': 0.38; 'list,': 0.38; 'pm,': 0.38; 'rather': 0.38; 'subject:': 0.39; 'to:addr:python.org': 0.39; 'changed': 0.39; 'received:org': 0.40; 'most': 0.60; 'received:173': 0.61; 'kind': 0.63; 'such': 0.63; 'friendly': 0.72; 'received:fios.verizon.net': 0.84; 'carries': 0.91; 'reasoning': 0.91
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Terry Jan Reedy <tjreedy@udel.edu>
Subject Re: suggestion for a small addition to the Python 3 list class
Date Sun, 21 Apr 2013 21:44:05 -0400
References <5173ACC00200007C000B7024@gwiawt1.is-svr.luc.edu> <87vc7fvmdf.fsf@nautilus.nautilus>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host pool-173-75-251-66.phlapa.fios.verizon.net
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130328 Thunderbird/17.0.5
In-Reply-To <87vc7fvmdf.fsf@nautilus.nautilus>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.894.1366595053.3114.python-list@python.org> (permalink)
Lines 36
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1366595053 news.xs4all.nl 2196 [2001:888:2000:d::a6]:49991
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:44029

Show key headers only | View raw


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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web