Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #46547
| Newsgroups | comp.lang.python |
|---|---|
| Date | 2013-05-30 15:01 -0700 |
| References | <CAGVx7UWXAFHSHq37Ep-Vk=cM2wYrEGHSUhNc8s43bCvj_VcVow@mail.gmail.com> <CAGGBd_oT=vqvPGZy+d1H=XHjdPCmYUxJMXAwii7WH845xrYybQ@mail.gmail.com> <mailman.2389.1369876474.3114.python-list@python.org> <851ce96a-0223-42b0-8d99-902294c71f58@hc4g2000pbb.googlegroups.com> <mailman.2443.1369939057.3114.python-list@python.org> |
| Message-ID | <32d47a30-8b74-41f4-a774-c878c60c7f73@googlegroups.com> (permalink) |
| Subject | Re: How clean/elegant is Python's syntax? |
| From | John Ladasky <john_ladasky@sbcglobal.net> |
On Thursday, May 30, 2013 11:36:54 AM UTC-7, Ian wrote: > I don't object to changing the join method (one of the more > shoe-horned string methods) back into a function, but to my eyes > you've got the arguments backward. It should be: > > def join(sep, iterable): return sep.join(iterable) > > Putting the separator first feels more natural to me because I expect > the separator to usually be short as compared to the iterable, which > is often a longer expression (as is the case in both of your > subsequent usages). Placing the separator first also preserves > consistency of interface with the str.join and bytes.join functions, > as well as the older string.join function. That may all be true, but the join() function shown will return a sequence starting with iterable[0] (followed by sep, and then iterable[1], then sep, etc.). I find it more natural to see iterable as the first argument passed to join() for that reason. Season to taste, I guess.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: How clean/elegant is Python's syntax? Ma Xiaojun <damage3025@gmail.com> - 2013-05-30 09:14 +0800
Re: How clean/elegant is Python's syntax? rusi <rustompmody@gmail.com> - 2013-05-29 19:49 -0700
Re: How clean/elegant is Python's syntax? Ian Kelly <ian.g.kelly@gmail.com> - 2013-05-30 12:36 -0600
Re: How clean/elegant is Python's syntax? rusi <rustompmody@gmail.com> - 2013-05-30 11:47 -0700
Re: How clean/elegant is Python's syntax? John Ladasky <john_ladasky@sbcglobal.net> - 2013-05-30 15:01 -0700
Re: How clean/elegant is Python's syntax? Chris Angelico <rosuav@gmail.com> - 2013-05-31 04:44 +1000
Re: How clean/elegant is Python's syntax? Ian Kelly <ian.g.kelly@gmail.com> - 2013-05-30 12:51 -0600
Re: How clean/elegant is Python's syntax? MRAB <python@mrabarnett.plus.com> - 2013-05-30 20:38 +0100
Re: How clean/elegant is Python's syntax? Chris Angelico <rosuav@gmail.com> - 2013-05-31 07:28 +1000
Re: How clean/elegant is Python's syntax? Ian Kelly <ian.g.kelly@gmail.com> - 2013-05-31 09:43 -0600
Re: How clean/elegant is Python's syntax? Chris Angelico <rosuav@gmail.com> - 2013-06-01 04:52 +1000
csiph-web