Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #44009
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <ryacobellis@luc.edu> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'string.': 0.05; 'sufficient': 0.05; 'subject:Python': 0.06; 'computing,': 0.07; 'filename:fname piece:py': 0.07; 'method.': 0.07; 'string': 0.09; 'method,': 0.09; 'parameter': 0.09; 'type,': 0.09; 'python': 0.11; 'sections': 0.14; '(however,': 0.16; 'class).': 0.16; 'class:': 0.16; 'comp': 0.16; 'email)': 0.16; 'iterable': 0.16; 'iterable,': 0.16; 'loyola': 0.16; "method's": 0.16; 'sense:': 0.16; 'splits': 0.16; 'subject:class': 0.16; 'suggestion.': 0.16; 'elements': 0.16; '(the': 0.22; 'proposed': 0.22; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; "i've": 0.25; "doesn't": 0.30; 'robert': 0.30; 'specified': 0.30; 'subject:list': 0.30; "i'm": 0.30; 'code': 0.31; 'comments': 0.31; 'class': 0.32; 'noticed': 0.34; 'subject:the': 0.34; 'except': 0.35; 'add': 0.35; 'university,': 0.36; 'method': 0.36; 'charset:us-ascii': 0.36; 'thanks': 0.36; 'similar': 0.36; 'list': 0.37; 'received:10': 0.37; 'skip:o 20': 0.38; 'lists.': 0.38; 'to:addr:python-list': 0.38; 'little': 0.38; 'to:addr:python.org': 0.39; 'space': 0.40; 'how': 0.40; 'most': 0.60; 'tell': 0.60; 'received:unknown': 0.61; 'header:Message- Id:1': 0.63; 'more': 0.64; 'teach': 0.65; 'content- type:application/octet-stream': 0.65; 'chicago,': 0.68; 'introduction': 0.68; 'dr.': 0.77; '"join': 0.84; 'str.': 0.91 |
| X-Warning | RFC compliance checks disabled due to whitelist |
| X-Warning | Reverse-Path DNS check skipped due to whitelist |
| X-Warning | Maximum message size check skipped due to whitelist |
| X-Warning | Realtime Block Lists skipped due to whitelist |
| X-Warning | Anti-Virus check skipped due to whitelist |
| X-Warning | Anti-Spam check skipped due to whitelist |
| X-Whitelist | 4067 |
| X-Envelope-From | ryacobellis@luc.edu |
| X-Envelope-To | python-list@python.org |
| X-Mailer | Novell GroupWise Internet Agent 8.0.3 |
| Date | Sun, 21 Apr 2013 09:09:20 -0500 |
| From | "Robert Yacobellis" <ryacobellis@luc.edu> |
| To | <python-list@python.org> |
| Subject | suggestion for a small addition to the Python 3 list class |
| Mime-Version | 1.0 |
| Content-Type | multipart/mixed; boundary="=__PartB9899600.2__=" |
| Cc | anh@cs.luc.edu |
| 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.882.1366557472.3114.python-list@python.org> (permalink) |
| Lines | 138 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1366557472 news.xs4all.nl 2280 [2001:888:2000:d::a6]:52091 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:44009 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
Greetings, I'm an instructor of Computer Science at Loyola University, Chicago, and I and Dr. Harrington (copied on this email) teach sections of COMP 150, Introduction to Computing, using Python 3. One of the concepts we teach students is the str methods split() and join(). I have a suggestion for a small addition to the list class: add a join() method to lists. It would work in a similar way to how join works for str's, except that the object and method parameter would be reversed: <list object>.join(<str object>). Rationale: When I teach students about split(), I can intuitively tell them split() splits the string on its left on white space or a specified string. Explaining the current str join() method to them doesn't seem to make as much sense: use the string on the left to join the items in the list?? If the list class had a join method, it would be more intuitive to say "join the items in the list using the specified string (the method's argument)." This is similar to Scala's List mkString() method. I've attached a proposed implementation in Python code which is a little more general than what I've described. In this implementation the list can contain elements of any type, and the separator can also be any data type, not just str. 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). Please let me know your ideas, reactions, and comments on this suggestion. Thanks and regards, Dr. Robert (Bob) Yacobellis
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
suggestion for a small addition to the Python 3 list class "Robert Yacobellis" <ryacobellis@luc.edu> - 2013-04-21 09:09 -0500 Re: suggestion for a small addition to the Python 3 list class Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-04-21 19:53 +0000
csiph-web