Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #46538
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder1.xlned.com!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python@mrabarnett.plus.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.003 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'python.': 0.02; 'argument': 0.05; 'subject:Python': 0.06; 'args': 0.07; 'ugly': 0.07; 'string': 0.09; 'arguments': 0.09; 'function,': 0.09; 'subject:How': 0.10; 'def': 0.12; 'be:': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'iterable': 0.16; 'message- id:@mrabarnett.plus.com': 0.16; 'received:84.93': 0.16; 'received:84.93.230': 0.16; 'wrote:': 0.18; 'wed,': 0.18; "skip:' 30": 0.19; 'written': 0.21; 'seems': 0.21; '>>>': 0.22; 'putting': 0.22; 'print': 0.22; 'header:User-Agent:1': 0.23; '31,': 0.24; "aren't": 0.24; 'instance,': 0.24; 'second': 0.26; 'subject:/': 0.26; '(for': 0.26; 'code:': 0.26; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'chris': 0.29; 'am,': 0.29; 'too.': 0.31; '>>>>': 0.31; 'sep': 0.31; 'fri,': 0.33; 'trouble': 0.34; 'sense': 0.34; "can't": 0.35; 'received:84': 0.35; 'but': 0.35; 'method': 0.36; 'subject:?': 0.36; 'should': 0.36; 'changing': 0.37; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'rather': 0.38; 'to:addr:python.org': 0.39; 'either': 0.39; 'ian': 0.60; 'first': 0.61; 'back': 0.62; "you've": 0.63; 'interest': 0.64; 'more': 0.64; '30,': 0.65; 'header:Reply-To:1': 0.67; 'default': 0.69; 'reply-to:no real name:2**0': 0.71; 'eyes': 0.78; 'hardly': 0.84; 'reply-to:addr:python.org': 0.84; 'rusi': 0.91; '2013': 0.98 |
| X-CM-Score | 0.00 |
| X-CNFS-Analysis | v=2.1 cv=cIzZ7DuN c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=oyR3mlnJdzkA:10 a=mNjt8o-4iKoA:10 a=ihvODaAuJD4A:10 a=OUOv7kDek9cA:10 a=8nJEP1OIZ-IA:10 a=EBOSESyhAAAA:8 a=8AHkEIZyAAAA:8 a=qmD6G9WjKUoA:10 a=pGLkceISAAAA:8 a=W75huZ-Pci0m1oZHcoUA:9 a=wPNLvfGTeEIA:10 a=MSl-tDqOz04A:10 |
| X-AUTH | mrabarnett:2500 |
| Date | Thu, 30 May 2013 20:38:40 +0100 |
| From | MRAB <python@mrabarnett.plus.com> |
| User-Agent | Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130509 Thunderbird/17.0.6 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: How clean/elegant is Python's syntax? |
| 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> <CALwzidkvPJFWh1csV+sC6mFb9bZFaft_T5e+5E49eHucBTf-hQ@mail.gmail.com> <CAPTjJmqHE_Ctyn5dEL3TeXaan4_cF9JUWHi_hMb2nyafhpn5CQ@mail.gmail.com> |
| In-Reply-To | <CAPTjJmqHE_Ctyn5dEL3TeXaan4_cF9JUWHi_hMb2nyafhpn5CQ@mail.gmail.com> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| Reply-To | python-list@python.org |
| 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.2448.1369942708.3114.python-list@python.org> (permalink) |
| Lines | 34 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1369942708 news.xs4all.nl 15876 [2001:888:2000:d::a6]:50124 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:46538 |
Show key headers only | View raw
On 30/05/2013 19:44, Chris Angelico wrote:
> On Fri, May 31, 2013 at 4:36 AM, Ian Kelly <ian.g.kelly@gmail.com> wrote:
>> On Wed, May 29, 2013 at 8:49 PM, rusi <rustompmody@gmail.com> wrote:
>>> On May 30, 6:14 am, Ma Xiaojun <damage3...@gmail.com> wrote:
>>>> What interest me is a one liner:
>>>> print '\n'.join(['\t'.join(['%d*%d=%d' % (j,i,i*j) for i in
>>>> range(1,10)]) for j in range(1,10)])
>>>
>>> Ha,Ha! The join method is one of the (for me) ugly features of python.
>>> You can sweep it under the carpet with a one-line join function and
>>> then write clean and pretty code:
>>>
>>> #joinwith
>>> def joinw(l,sep): return sep.join(l)
>>
>> 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)
>
> Trouble is, it makes some sense either way. I often put the larger
> argument first - for instance, I would write 123412341324*5 rather
> than the other way around - and in this instance, it hardly seems as
> clear-cut as you imply. But the function can't be written to take them
> in either order, because strings are iterable too. (And functions that
> take args either way around aren't better than those that make a
> decision.)
>
And additional argument (pun not intended) for putting sep second is
that you can give it a default value:
def join(iterable, sep=""): return sep.join(iterable)
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