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: 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" To: 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__PartB9899600.2__= Content-Type: multipart/alternative; boundary="=__PartB9899600.3__=" --=__PartB9899600.3__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Greetings, =20 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: .join(). =20 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. =20 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. =20 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). =20 Please let me know your ideas, reactions, and comments on this suggestion. =20 Thanks and regards, Dr. Robert (Bob) Yacobellis --=__PartB9899600.3__= Content-Type: text/html; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Description: HTML
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-pro= vided 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
--=__PartB9899600.3__=-- --=__PartB9899600.2__= Content-Type: application/octet-stream; name="join.py" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="join.py" Y2xhc3MgbGlzdDIobGlzdCk6ICMgYWRkIGEgam9pbiBtZXRob2QgdG8gbGlzdHMNCglkZWYgam9p bihzZWxmLCBzZXA9JyAnKTogIyBkZWZhdWx0IHNlcGFyYXRvciBpcyBhIHNpbmdsZSBzcGFjZQ0K CQlpZiBub3QgaXNpbnN0YW5jZShzZXAsc3RyKTogIyB0aGUgc2VwYXJhdG9yIHNob3VsZCBiZSBh IHN0cmluZw0KCQkJIyBhIHJ1bnRpbWUgZXJyb3IgY291bGQgYmUgdGhyb3duIGhlcmUNCgkJCXNl cCA9IHN0cihzZXApICMgZm9yIG5vdywganVzdCBjb252ZXJ0IHMgdG8gYSBzdHJpbmcNCgkJb3V0 cHV0ID0gJycgIyBhY2N1bXVsYXRlIHRoaXMgYXMgdGhlIG91dHB1dCBzdHJpbmcNCgkJaW5uZXIg PSAnJyAjIGZvciBmaXJzdCB0aW1lIHRocm91Z2ggdGhlIGZvciBsb29wDQoJCWZvciBpdGVtIGlu IHNlbGY6ICMgaXRlcmF0ZSB0aHJvdWdoIHRoZSBpbnB1dA0KCQkJb3V0cHV0ICs9IGlubmVyICsg c3RyKGl0ZW0pICMgY29udmVydCBpdGVtIHRvIHN0cmluZyBpZiBub3QgYWxyZWFkeQ0KCQkJaW5u ZXIgPSBzZXAgIyB1c2UgdGhlIHNlcGFyYXRvciBzdHJpbmcgYWZ0ZXIgdGhlIGZpcnN0IHRpbWUg dGhyb3VnaA0KCQlyZXR1cm4gb3V0cHV0ICMgaWYgaW5wdXQgaXRlcmF0b3IgaXMgZW1wdHksIHJl dHVybnMgdGhlIGVtcHR5IHN0cmluZw0K --=__PartB9899600.2__= Content-Type: application/octet-stream; name="jointest.py" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="jointest.py" ZnJvbSBqb2luIGltcG9ydCAqDQoNCm15TGlzdCA9IGxpc3QyKFsiYSIsICJiIiwgImMiXSkNCnBy aW50KCdteUxpc3Q6JykNCnByaW50KG15TGlzdC5qb2luKCkpICMgam9pbiB3aXRoIGEgc3BhY2UN CnByaW50KG15TGlzdC5qb2luKCcjIycpKSAjIGpvaW4gd2l0aCAnIyMnDQpwcmludChteUxpc3Qu am9pbig0MikpICMgam9pbiB3aXRoICc0MicNCnByaW50KG15TGlzdC5qb2luKCcnKSkgIyBqb2lu IHdpdGggdGhlIGVtcHR5IHN0cmluZw0KcHJpbnQoKQ0KbXlMaXN0MiA9IGxpc3QyKFsxLCAyLjAs IHszfV0pDQpwcmludCgnbXlMaXN0MjonKQ0KcHJpbnQobXlMaXN0Mi5qb2luKCkpICMgam9pbiB3 aXRoIGEgc3BhY2UNCnByaW50KG15TGlzdDIuam9pbignIyMnKSkgIyBqb2luIHdpdGggJyMjJw0K cHJpbnQobXlMaXN0Mi5qb2luKDQyKSkgIyBqb2luIHdpdGggJzQyJw0KcHJpbnQobXlMaXN0Mi5q b2luKCcnKSkgIyBqb2luIHdpdGggdGhlIGVtcHR5IHN0cmluZw0KcHJpbnQoKQ0KbXlMaXN0MyA9 IGxpc3QyKFtkaWN0KCldKQ0KcHJpbnQoJ215TGlzdDM6JykNCnByaW50KG15TGlzdDMuam9pbigp KSAjIGpvaW4gd2l0aCBhIHNwYWNlDQpwcmludChteUxpc3QzLmpvaW4oJyMjJykpICMgam9pbiB3 aXRoICcjIycNCnByaW50KG15TGlzdDMuam9pbig0MikpICMgam9pbiB3aXRoICc0MicNCnByaW50 KG15TGlzdDMuam9pbignJykpICMgam9pbiB3aXRoIHRoZSBlbXB0eSBzdHJpbmcNCnByaW50KCkN Cm15TGlzdDQgPSBsaXN0MigieHl6IikNCnByaW50KCdteUxpc3Q0OicpDQpwcmludChteUxpc3Q0 LmpvaW4oKSkgIyBqb2luIHdpdGggYSBzcGFjZQ0KcHJpbnQobXlMaXN0NC5qb2luKCcjIycpKSAj IGpvaW4gd2l0aCAnIyMnDQpwcmludChteUxpc3Q0LmpvaW4oNDIpKSAjIGpvaW4gd2l0aCAnNDIn DQpwcmludChteUxpc3Q0LmpvaW4oJycpKSAjIGpvaW4gd2l0aCB0aGUgZW1wdHkgc3RyaW5nDQpw cmludCgpDQpteUxpc3Q1ID0gbGlzdDIoKQ0KcHJpbnQoJ215TGlzdDU6JykNCnByaW50KG15TGlz dDUuam9pbigpKSAjIGpvaW4gd2l0aCBhIHNwYWNlDQpwcmludChteUxpc3Q1LmpvaW4oJyMjJykp ICMgam9pbiB3aXRoICcjIycNCnByaW50KG15TGlzdDUuam9pbig0MikpICMgam9pbiB3aXRoICc0 MicNCnByaW50KG15TGlzdDUuam9pbignJykpICMgam9pbiB3aXRoIHRoZSBlbXB0eSBzdHJpbmcN CnByaW50KCkNCmlucHV0KCJQcmVzcyBFbnRlciB0byBlbmQgdGhpcyBwcm9ncmFtIik= --=__PartB9899600.2__=--