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


Groups > comp.lang.python > #108397 > unrolled thread

Steve D'Aprano, you're the "master". What's wrong with this concatenation statement?

Started byDFS <nospam@dfs.com>
First post2016-05-08 19:10 -0400
Last post2016-05-12 18:40 +1000
Articles 19 on this page of 59 — 22 participants

Back to article view | Back to comp.lang.python


Contents

  Steve D'Aprano, you're the "master". What's wrong with this concatenation statement? DFS <nospam@dfs.com> - 2016-05-08 19:10 -0400
    Re: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement? Tim Chase <python.list@tim.thechases.com> - 2016-05-08 18:37 -0500
    Re: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement? Joel Goldstick <joel.goldstick@gmail.com> - 2016-05-08 20:02 -0400
    String concatenation (was: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement?) Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-05-09 02:44 +0200
      Re: String concatenation (was: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement?) Chris Angelico <rosuav@gmail.com> - 2016-05-09 12:16 +1000
        Re: String concatenation Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-05-09 23:21 +0200
          Re: String concatenation Steven D'Aprano <steve@pearwood.info> - 2016-05-10 12:32 +1000
            Re: String concatenation Chris Angelico <rosuav@gmail.com> - 2016-05-10 12:42 +1000
              Re: String concatenation Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2016-05-12 17:43 +1000
          Re: String concatenation Rustom Mody <rustompmody@gmail.com> - 2016-05-09 20:45 -0700
            Re: String concatenation Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2016-05-10 16:46 +1000
              Re: String concatenation Paul Rubin <no.email@nospam.invalid> - 2016-05-10 00:13 -0700
                Re: String concatenation Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2016-05-10 17:54 +1000
                  Re: String concatenation David Palao <dpalao.python@gmail.com> - 2016-05-10 10:15 +0200
                    Re: String concatenation Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2016-05-12 17:27 +1000
      Re: String concatenation (was: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement?) srinivas devaki <mr.eightnoteight@gmail.com> - 2016-05-09 09:01 +0530
      Re: String concatenation (was: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement?) srinivas devaki <mr.eightnoteight@gmail.com> - 2016-05-09 09:13 +0530
      Re: String concatenation (was: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement?) Michael Selik <michael.selik@gmail.com> - 2016-05-09 18:29 +0000
      Re: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement? DFS <nospam@dfs.com> - 2016-05-10 19:53 -0400
        Re: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-05-11 02:16 +0200
          Re: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement? DFS <nospam@dfs.com> - 2016-05-10 20:33 -0400
          Moderation [was Re: ...What's wrong with this concatenation statement?] Steven D'Aprano <steve@pearwood.info> - 2016-05-11 11:17 +1000
          Re: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement? Chris Angelico <rosuav@gmail.com> - 2016-05-11 11:43 +1000
            Re: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-05-11 21:12 +0200
          Re: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement? Ned Batchelder <ned@nedbatchelder.com> - 2016-05-11 12:39 -0700
            Re: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement? Chris Angelico <rosuav@gmail.com> - 2016-05-12 09:07 +1000
            Re: % formatting vs .format() (was: What's wrong with this concatenation statement?) Tim Chase <python.list@tim.thechases.com> - 2016-05-11 18:31 -0500
      Re: String concatenation (was: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement?) sohcahtoa82@gmail.com - 2016-05-10 17:38 -0700
        Re: String concatenation Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-05-11 21:14 +0200
          Re: String concatenation sohcahtoa82@gmail.com - 2016-05-11 14:30 -0700
            Re: String concatenation Ned Batchelder <ned@nedbatchelder.com> - 2016-05-11 14:50 -0700
            Re: String concatenation DFS <nospam@dfs.com> - 2016-05-11 18:25 -0400
    Re: What's wrong with this concatenation statement? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2016-05-09 17:53 +1000
      Re: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement? DFS <nospam@dfs.com> - 2016-05-10 12:16 -0400
        Re: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement? Rustom Mody <rustompmody@gmail.com> - 2016-05-10 09:41 -0700
        Re: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement? Stephen Hansen <me+python@ixokai.io> - 2016-05-10 09:42 -0700
          Re: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement? DFS <nospam@dfs.com> - 2016-05-10 18:37 -0400
        Re: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement? Steven D'Aprano <steve@pearwood.info> - 2016-05-11 02:44 +1000
        Re: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement? Ian Kelly <ian.g.kelly@gmail.com> - 2016-05-10 12:15 -0600
          Re: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement? DFS <nospam@dfs.com> - 2016-05-10 17:21 -0400
            Re: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement? Chris Angelico <rosuav@gmail.com> - 2016-05-11 07:27 +1000
              Re: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement? DFS <nospam@dfs.com> - 2016-05-10 19:40 -0400
                Re: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement? Paul Rubin <no.email@nospam.invalid> - 2016-05-10 19:14 -0700
                Re: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement? alister <alister.ware@ntlworld.com> - 2016-05-12 09:12 +0000
                  Re: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement? Chris Angelico <rosuav@gmail.com> - 2016-05-12 19:23 +1000
                    Re: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement? DFS <nospam@dfs.com> - 2016-05-12 08:24 -0400
                  Re: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement? Michael Torrie <torriem@gmail.com> - 2016-05-12 08:39 -0600
                  Why online forums have bad behaviour (was: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement?) Ben Finney <ben+python@benfinney.id.au> - 2016-05-13 05:36 +1000
                  Re: Why online forums have bad behaviour (was: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement?) Jason Friedman <jsf80238@gmail.com> - 2016-05-12 21:05 -0600
            Re: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement? Ethan Furman <ethan@stoneleaf.us> - 2016-05-10 15:12 -0700
              Re: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement? DFS <nospam@dfs.com> - 2016-05-10 19:29 -0400
                Re: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement? Jon Ribbens <jon+usenet@unequivocal.co.uk> - 2016-05-12 13:39 +0000
                  Re: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement? Chris Angelico <rosuav@gmail.com> - 2016-05-12 23:50 +1000
            Re: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement? Ethan Furman <ethan@stoneleaf.us> - 2016-05-10 16:16 -0700
              Re: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement? DFS <nospam@dfs.com> - 2016-05-10 19:41 -0400
    Re: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement? srinivas devaki <mr.eightnoteight@gmail.com> - 2016-05-12 13:53 +0530
      Re: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement? Ned Batchelder <ned@nedbatchelder.com> - 2016-05-12 02:36 -0700
        Re: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement? Steven D'Aprano <steve@pearwood.info> - 2016-05-13 01:06 +1000
    Re: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement? Chris Angelico <rosuav@gmail.com> - 2016-05-12 18:40 +1000

Page 3 of 3 — ← Prev page 1 2 [3]


#108491

FromChris Angelico <rosuav@gmail.com>
Date2016-05-11 07:27 +1000
Message-ID<mailman.577.1462915657.32212.python-list@python.org>
In reply to#108490
On Wed, May 11, 2016 at 7:21 AM, DFS <nospam@dfs.com> wrote:
> Take your net-nannying somewhere else.  It's not welcome /anywhere/.

DFS, you are out of line. Please reconsider the *way* you are saying
things, and especially, don't call people names.

ChrisA

[toc] | [prev] | [next] | [standalone]


#108498

FromDFS <nospam@dfs.com>
Date2016-05-10 19:40 -0400
Message-ID<ngtra9$n7s$1@dont-email.me>
In reply to#108491
On 5/10/2016 5:27 PM, Chris Angelico wrote:
> On Wed, May 11, 2016 at 7:21 AM, DFS <nospam@dfs.com> wrote:
>> Take your net-nannying somewhere else.  It's not welcome /anywhere/.
>
> DFS, you are out of line.


I disagree.

Nothing worse than netnannies threatening censorship and trying to tell 
you how to post.

Why would you guys tolerate this Ethanol Furman character?



> Please reconsider the *way* you are saying things,

I understand it's a technical/language group, but everyone has their own 
style.

I try to never intentionally insult anyone unless I'm insulted first. 
Sometimes I try to be a funny smart-aleck and it doesn't work.

But, I am dead serious about becoming a good Python developer, and I 
truly appreciate all clp replies.


> and especially, don't call people names.

Maybe.  I'll always call a spade a spade.



Note: Angelico is about the coolest last name I've heard in a long time. 
   Is it real?

[toc] | [prev] | [next] | [standalone]


#108512

FromPaul Rubin <no.email@nospam.invalid>
Date2016-05-10 19:14 -0700
Message-ID<87mvnx7334.fsf@jester.gateway.pace.com>
In reply to#108498
DFS <nospam@dfs.com> writes:
> But, I am dead serious about becoming a good Python developer, and I
> truly appreciate all clp replies.

People are more likely to reply to you if your posting style makes you
enjoyable instead of annoying to engage with.  That's community spirit.
Friendly participation is always welcomed even when the person is new or
otherwise not highly knowledgeable.

Failing that, if you're a knowledgeable enough developer that people
learn things from your posts even at moments when your style is
annoying, they might interact with you for the self-interested sake of
benefiting from access to your knowledge.  There are some regulars here
whose stuff is always worth reading even though they can be prickly at
times.

If you don't bring worthwhile amounts of knowledge AND your posting
style is annoying, there's a considerable incentive to not bother
reading your stuff at all.  That will tend to decrease the amount of
replies you receive.

Hope this helps!

[toc] | [prev] | [next] | [standalone]


#108549

Fromalister <alister.ware@ntlworld.com>
Date2016-05-12 09:12 +0000
Message-ID<ANXYy.768757$2u3.504570@fx35.am4>
In reply to#108498
On Tue, 10 May 2016 19:40:02 -0400, DFS wrote:

> Sometimes I try to be a funny smart-aleck and it doesn't work.

this is the problem everyone is having with your post, you acknowledge 
that it doesn't work so why keep trying.

I too can fall guilty of this behavior (I can be a bit condescending of 
one of our engineers calls for help & asks a question he should already 
know)  but have learnt that when I am asking for help it is probably not 
a good idea to upset the person I am asking.
> 
> But, I am dead serious about becoming a good Python developer, and I
> truly appreciate all clp replies.
> 
> 
>> and especially, don't call people names.
> 
> Maybe.  I'll always call a spade a spade.
> 
> 
> 
> Note: Angelico is about the coolest last name I've heard in a long time.
>    Is it real?





-- 
I can mend the break of day, heal a broken heart, and provide temporary
relief to nymphomaniacs.
		-- Larry Lee

[toc] | [prev] | [next] | [standalone]


#108550

FromChris Angelico <rosuav@gmail.com>
Date2016-05-12 19:23 +1000
Message-ID<mailman.607.1463044997.32212.python-list@python.org>
In reply to#108549
On Thu, May 12, 2016 at 7:12 PM, alister <alister.ware@ntlworld.com> wrote:
> [presumably DFS wrote, but I didn't see]
>> Note: Angelico is about the coolest last name I've heard in a long time.
>>    Is it real?

It is, actually! It's a precious heirloom. It belonged to my father,
the great Talldad; and it belonged to his father (my grandfather), and
his father. It's been in the family for quite a while, and I'm very
careful not to let it get damaged.

ChrisA

[toc] | [prev] | [next] | [standalone]


#108554

FromDFS <nospam@dfs.com>
Date2016-05-12 08:24 -0400
Message-ID<nh1sfu$clv$1@dont-email.me>
In reply to#108550
On 5/12/2016 5:23 AM, Chris Angelico wrote:
> On Thu, May 12, 2016 at 7:12 PM, alister <alister.ware@ntlworld.com> wrote:
>> [presumably DFS wrote, but I didn't see]
>>> Note: Angelico is about the coolest last name I've heard in a long time.
>>>    Is it real?
>
> It is, actually! It's a precious heirloom. It belonged to my father,
> the great Talldad; and it belonged to his father (my grandfather), and
> his father. It's been in the family for quite a while, and I'm very
> careful not to let it get damaged.
>
> ChrisA


If it did break, it might get glued back together as Loincage.

Wouldn't want that...



[toc] | [prev] | [next] | [standalone]


#108557

FromMichael Torrie <torriem@gmail.com>
Date2016-05-12 08:39 -0600
Message-ID<mailman.611.1463063967.32212.python-list@python.org>
In reply to#108549
On 05/12/2016 03:12 AM, alister wrote:
> On Tue, 10 May 2016 19:40:02 -0400, DFS wrote:
> 
>> Sometimes I try to be a funny smart-aleck and it doesn't work.
> 
> this is the problem everyone is having with your post, you acknowledge 
> that it doesn't work so why keep trying.
> 
> I too can fall guilty of this behavior (I can be a bit condescending of 
> one of our engineers calls for help & asks a question he should already 
> know)  but have learnt that when I am asking for help it is probably not 
> a good idea to upset the person I am asking.

>> Maybe.  I'll always call a spade a spade.

It's really sad to see folks like DFS hop on the list with apparent
enthusiasm for Python and an excitement to learn, only to resort to name
calling and walk away in a huff when folks ask them not to speak that
way around here.  I'm not sure why this is.  I recall that the same
thing happened not so long ago with another poster I recall.  Overall I
think list members are pretty patient with newbies.

[toc] | [prev] | [next] | [standalone]


#108567 — Why online forums have bad behaviour (was: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement?)

FromBen Finney <ben+python@benfinney.id.au>
Date2016-05-13 05:36 +1000
SubjectWhy online forums have bad behaviour (was: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement?)
Message-ID<mailman.616.1463081804.32212.python-list@python.org>
In reply to#108549
Michael Torrie <torriem@gmail.com> writes:

> It's really sad to see folks like DFS hop on the list with apparent
> enthusiasm for Python and an excitement to learn, only to resort to
> name calling and walk away in a huff when folks ask them not to speak
> that way around here. I'm not sure why this is.

TL;DR: because we're all human, and human behaviour needs either
immediate face-to-face feedback or social enforcement to correct
selfishness and abrasiveness. Where face-to-face feedback is lacking,
social enforcement needs to take more of the load.


Many people have a false sense of entitlement to be caustic in dealing
with others, and have no better response to a request that they tone it
down than to escalate their bad behaviour.

This behaviour is usually counteracted in face-to-face interaction, by
being confronted with the immediate result on the other person: most
people don't enjoy *seeing* other people become upset, so most people
tend to work harder to be more polite in face-to-face discussion.

On an internet forum, especially one with such low bandwidth as text,
these feedback mechanisms are not sufficient (not immediate enough, and
not informative enough) for the person to experience a link from their
bad behaviour to the unpleasant consequences.


This isn't a new problem. It's not new to the internet, and it certainly
isn't new to humans.

What is new, though, is that many online communities – the Python
community specifically – have decided we are not going to tolerate
anti-social behaviour, and we have also enacted policies to enforce that
decision.

We'll always have some anti-social actors, and bad actions by otherwise
good actors. Many of them when confronted will respond with petulance
and name-calling and bullying and other schoolyard reflexes. We have to
be consistent in rejecting such behaviour from our community.

-- 
 \          “Writing a book is like washing an elephant: there no good |
  `\        place to begin or end, and it's hard to keep track of what |
_o__)                              you've already covered.” —anonymous |
Ben Finney

[toc] | [prev] | [next] | [standalone]


#108572 — Re: Why online forums have bad behaviour (was: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement?)

FromJason Friedman <jsf80238@gmail.com>
Date2016-05-12 21:05 -0600
SubjectRe: Why online forums have bad behaviour (was: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement?)
Message-ID<mailman.619.1463108759.32212.python-list@python.org>
In reply to#108549
> TL;DR: because we're all human, and human behaviour needs either
> immediate face-to-face feedback or social enforcement to correct
> selfishness and abrasiveness. Where face-to-face feedback is lacking,
> social enforcement needs to take more of the load.
>
>
> Many people have a false sense of entitlement to be caustic in dealing
> with others, and have no better response to a request that they tone it
> down than to escalate their bad behaviour.
>
> This behaviour is usually counteracted in face-to-face interaction, by
> being confronted with the immediate result on the other person: most
> people don't enjoy *seeing* other people become upset, so most people
> tend to work harder to be more polite in face-to-face discussion.
>
> On an internet forum, especially one with such low bandwidth as text,
> these feedback mechanisms are not sufficient (not immediate enough, and
> not informative enough) for the person to experience a link from their
> bad behaviour to the unpleasant consequences.
>
>
> This isn't a new problem. It's not new to the internet, and it certainly
> isn't new to humans.
>
> What is new, though, is that many online communities – the Python
> community specifically – have decided we are not going to tolerate
> anti-social behaviour, and we have also enacted policies to enforce that
> decision.
>
> We'll always have some anti-social actors, and bad actions by otherwise
> good actors. Many of them when confronted will respond with petulance
> and name-calling and bullying and other schoolyard reflexes. We have to
> be consistent in rejecting such behaviour from our community.

Well said.

[toc] | [prev] | [next] | [standalone]


#108492

FromEthan Furman <ethan@stoneleaf.us>
Date2016-05-10 15:12 -0700
Message-ID<mailman.578.1462918342.32212.python-list@python.org>
In reply to#108490
On 05/10/2016 02:21 PM, DFS wrote:
> On 5/9/2016 3:53 AM, Steven D'Aprano wrote:

>> Pointlessly provocative subject line edited.

> huh?  You called yourself a "master crafts/wo/man".

> Challenging someone's boastful claim isn't trolling.

> My expectation was to not be met by smug, sanctimonious and
> condescending replies from the likes of DuhPricko.

> 'master craftswoman' my ass...

> Take your net-nannying somewhere else.  It's not welcome /anywhere/.

Having found and read D'Aprano's post I can assure you that:

- he wasn't claiming to be a master craftsman
- he wasn't being arrogant

I can also assure you that *you* are being hostile, rude, and 
discriminatory, and such behaviour is not welcome here.

Any further posts of this nature and you will be placed on moderation.

--
~Ethan~

[toc] | [prev] | [next] | [standalone]


#108497

FromDFS <nospam@dfs.com>
Date2016-05-10 19:29 -0400
Message-ID<ngtqmr$lhg$1@dont-email.me>
In reply to#108492
On 5/10/2016 6:12 PM, Ethan Merman wrote:

> On 05/10/2016 02:21 PM, DFS wrote:
>> On 5/9/2016 3:53 AM, Steven D'Aprano wrote:
>
>>> Pointlessly provocative subject line edited.
>
>> huh?  You called yourself a "master crafts/wo/man".
>
>> Challenging someone's boastful claim isn't trolling.
>
>> My expectation was to not be met by smug, sanctimonious and
>> condescending replies from the likes of DuhPricko.
>
>> 'master craftswoman' my ass...
>
>> Take your net-nannying somewhere else.  It's not welcome /anywhere/.
>
> Having found and read D'Aprano's post I can assure you that:
> - he wasn't claiming to be a master craftsman

Yes he was.


> - he wasn't being arrogant

Yes he was.



> I can also assure you that *you* are being hostile, rude,

I disagree.


> and discriminatory

Not in the least.



 > and such behaviour is not welcome here.
> Any further posts of this nature and you will be placed on moderation.

heh!

Who do you think you are?

This isn't a moderated group.  If you don't like me, I suggest a swift 
and silent plonk.

What is it with you Usenet busybodies trying to make everyone conform to 
what you find acceptable behavior and language and posting style?

You ought to be damn glad Usenet is uncensored, instead you want to ruin it.

[toc] | [prev] | [next] | [standalone]


#108555

FromJon Ribbens <jon+usenet@unequivocal.co.uk>
Date2016-05-12 13:39 +0000
Message-ID<slrnnj922m.16d.jon+usenet@wintry.unequivocal.co.uk>
In reply to#108497
On 2016-05-10, DFS <nospam@dfs.com> wrote:
> This isn't a moderated group.

That doesn't represent the whole truth. The Usenet group is
unmoderated but is gatewayed to a mailing list, which of course can be
moderated. So while you can't be moderated on the Usenet group, much
of the potential audience for posts here are actually reading via the
list, and hence won't see your posts if they are moderated out.

(Personally I think this situation is more than a little silly and
the group should be changed to moderated.)

[toc] | [prev] | [next] | [standalone]


#108556

FromChris Angelico <rosuav@gmail.com>
Date2016-05-12 23:50 +1000
Message-ID<mailman.609.1463061013.32212.python-list@python.org>
In reply to#108555
On Thu, May 12, 2016 at 11:39 PM, Jon Ribbens
<jon+usenet@unequivocal.co.uk> wrote:
> On 2016-05-10, DFS <nospam@dfs.com> wrote:
>> This isn't a moderated group.
>
> That doesn't represent the whole truth. The Usenet group is
> unmoderated but is gatewayed to a mailing list, which of course can be
> moderated. So while you can't be moderated on the Usenet group, much
> of the potential audience for posts here are actually reading via the
> list, and hence won't see your posts if they are moderated out.
>
> (Personally I think this situation is more than a little silly and
> the group should be changed to moderated.)

For example, I'm seeing this, but you're replying to something I didn't see.

It's one of the many advantages of reading the mailing list rather
than the newsgroup.

ChrisA

[toc] | [prev] | [next] | [standalone]


#108496

FromEthan Furman <ethan@stoneleaf.us>
Date2016-05-10 16:16 -0700
Message-ID<mailman.579.1462922172.32212.python-list@python.org>
In reply to#108490
On 05/10/2016 02:21 PM, DFS wrote:

[some inflammatory nonsense]

and is now being moderated.  If you see flame-bait in one of the 
unmoderated venues please ignore it.

Thanks.

--
~Ethan~

[toc] | [prev] | [next] | [standalone]


#108499

FromDFS <nospam@dfs.com>
Date2016-05-10 19:41 -0400
Message-ID<ngtrct$n7s$2@dont-email.me>
In reply to#108496
On 5/10/2016 7:16 PM, Ethan Furman wrote:
> On 05/10/2016 02:21 PM, DFS wrote:
>
> [some inflammatory nonsense]
>
> and is now being moderated.  If you see flame-bait in one of the
> unmoderated venues please ignore it.
>
> Thanks.
>
> --
> ~Ethan~



Everyone please ignore Ethanol's ridiculous attempt at censorship.

Thanks,
DFS

[toc] | [prev] | [next] | [standalone]


#108546

Fromsrinivas devaki <mr.eightnoteight@gmail.com>
Date2016-05-12 13:53 +0530
Message-ID<mailman.604.1463041482.32212.python-list@python.org>
In reply to#108397
On May 9, 2016 5:31 AM, "Tim Chase" <python.list@tim.thechases.com> wrote:
>
> then that's a bad code-smell (you get quadratic behavior as the
> strings are constantly resized), usually better replaced with
>

I just want to point out that in Python s += str in loop is not giving
quadratic behavior. I don't know why but it runs fast. I'm very much
interested to know why it is so?

In [3]: %%timeit
   ...: s = ''
   ...: for x in xrange(10**6):
   ...:     s += str(x)
   ...:
1 loop, best of 3: 383 ms per loop

In [4]: %%timeit
s = ''
for x in xrange(10**6):
    s = s + str(x)
   ...:
1 loop, best of 3: 383 ms per loop

[toc] | [prev] | [next] | [standalone]


#108551

FromNed Batchelder <ned@nedbatchelder.com>
Date2016-05-12 02:36 -0700
Message-ID<27532248-2e60-4b3f-98b5-436d357a3338@googlegroups.com>
In reply to#108546
On Thursday, May 12, 2016 at 4:24:55 AM UTC-4, srinivas devaki wrote:
> On May 9, 2016 5:31 AM, "Tim Chase" <python.list@tim.thechases.com> wrote:
> >
> > then that's a bad code-smell (you get quadratic behavior as the
> > strings are constantly resized), usually better replaced with
> >
> 
> I just want to point out that in Python s += str in loop is not giving
> quadratic behavior. I don't know why but it runs fast. I'm very much
> interested to know why it is so?
> 
> In [3]: %%timeit
>    ...: s = ''
>    ...: for x in xrange(10**6):
>    ...:     s += str(x)
>    ...:
> 1 loop, best of 3: 383 ms per loop
> 
> In [4]: %%timeit
> s = ''
> for x in xrange(10**6):
>     s = s + str(x)
>    ...:
> 1 loop, best of 3: 383 ms per loop

The CPython optimization depends on the string having only a single
reference.  A seemingly unrelated change to the code can change the
performance significantly:

    In [1]: %%timeit
       ...: s = ""
       ...: for x in xrange(100000):
       ...:   s = s + str(x)
       ...:
    10 loops, best of 3: 33.5 ms per loop

    In [2]: %%timeit
       ...: s = t = ""
       ...: for x in xrange(100000):
       ...:   s = t = s + str(x)
       ...:
    1 loop, best of 3: 1.57 s per loop

Be careful out there...

--Ned.

[toc] | [prev] | [next] | [standalone]


#108558

FromSteven D'Aprano <steve@pearwood.info>
Date2016-05-13 01:06 +1000
Message-ID<57349bec$0$1601$c3e8da3$5496439d@news.astraweb.com>
In reply to#108551
On Thu, 12 May 2016 07:36 pm, Ned Batchelder wrote:

> The CPython optimization depends on the string having only a single
> reference.  A seemingly unrelated change to the code can change the
> performance significantly:
> 
>     In [1]: %%timeit
>        ...: s = ""
>        ...: for x in xrange(100000):
>        ...:   s = s + str(x)
>        ...:
>     10 loops, best of 3: 33.5 ms per loop
> 
>     In [2]: %%timeit
>        ...: s = t = ""
>        ...: for x in xrange(100000):
>        ...:   s = t = s + str(x)
>        ...:
>     1 loop, best of 3: 1.57 s per loop


Nice demonstration!

But it is actually even worse than that. The optimization depends on memory
allocation details which means that some CPython interpreters cannot use
it, depending on the operating system and version.

Consequently, reliance on it can and has lead to embarrassments like this
performance bug which only affected *some* Windows users. In 2009, Chris
Withers asked for help debugging a problem where Python httplib was
hundreds of times slower than other tools, like wget and Internet Explorer:

https://mail.python.org/pipermail/python-dev/2009-August/091125.html

A few weeks later, Simon Cross realised the problem was probably the
quadratic behaviour of repeated string addition:

https://mail.python.org/pipermail/python-dev/2009-September/091582.html

leading to this quote from Antoine Pitrou:

"Given differences between platforms in realloc() performance, it might be
the reason why it goes unnoticed under Linux but degenerates under
Windows."

https://mail.python.org/pipermail/python-dev/2009-September/091583.html

and Guido's comment:

"Also agreed that this is an embarrassment."

https://mail.python.org/pipermail/python-dev/2009-September/091592.html

So beware of relying on the CPython string concatenation optimization in
production code!


Here's the tracker issue that added the optimization in the first place:

http://bugs.python.org/issue980695

The feature was controversial at the time (and remains slightly so):

https://mail.python.org/pipermail/python-dev/2004-August/046686.html


My opinion is that it is great for interactive use at the Python prompt, but
I would never use it in code I cared about.



-- 
Steven

[toc] | [prev] | [next] | [standalone]


#108547

FromChris Angelico <rosuav@gmail.com>
Date2016-05-12 18:40 +1000
Message-ID<mailman.605.1463042424.32212.python-list@python.org>
In reply to#108397
On Thu, May 12, 2016 at 6:23 PM, srinivas devaki
<mr.eightnoteight@gmail.com> wrote:
> On May 9, 2016 5:31 AM, "Tim Chase" <python.list@tim.thechases.com> wrote:
>>
>> then that's a bad code-smell (you get quadratic behavior as the
>> strings are constantly resized), usually better replaced with
>>
>
> I just want to point out that in Python s += str in loop is not giving
> quadratic behavior. I don't know why but it runs fast. I'm very much
> interested to know why it is so?
>
> In [3]: %%timeit
>    ...: s = ''
>    ...: for x in xrange(10**6):
>    ...:     s += str(x)
>    ...:
> 1 loop, best of 3: 383 ms per loop
>
> In [4]: %%timeit
> s = ''
> for x in xrange(10**6):
>     s = s + str(x)
>    ...:
> 1 loop, best of 3: 383 ms per loop

Some versions of CPython do include an optimization for this. However,
it's not guaranteed, and it's easy to disrupt. For starters, it works
only if you're appending to a string, not prepending; this will be
much slower:

s = ''
for x in range(10**6):
    s = str(x) + s

And other Pythons may not optimize this. So don't depend on it.

ChrisA

[toc] | [prev] | [standalone]


Page 3 of 3 — ← Prev page 1 2 [3]

Back to top | Article view | comp.lang.python


csiph-web