Re: Rule of order for dot operators?

2015-06-08 Thread Albert van der Horst
In article mailman.118.1431989304.17265.python-l...@python.org, Cameron Simpson c...@zip.com.au wrote: On 16May2015 12:20, C.D. Reimer ch...@cdreimer.com wrote: title = slug.replace('-',' ').title() This line also works if I switched the dot operators around. title = slug.title().replace('-',' ')

Re: Rule of order for dot operators?

2015-06-08 Thread Steven D'Aprano
On Mon, 8 Jun 2015 09:21 pm, Albert van der Horst wrote: Why is slug.title a valid decomposition of the total string (Or is it?) I'm afraid I don't understand the question. What is the ()-brackets doing? Does it force the execution of title, which gives something to be dotted onto slug

Re: Rule of order for dot operators?

2015-05-20 Thread Ben Finney
Thomas 'PointedEars' Lahn pointede...@web.de writes: Ned Batchelder wrote: Be considerate. Be respectful. And who appointed you moderator? Ned is telling you how we are all expected to behave here, and that you have violated the norms of behaviour to other participants here. He does so

Re: Rule of order for dot operators?

2015-05-19 Thread Chris Angelico
On Tue, May 19, 2015 at 12:43 PM, Ron Adam ron3...@gmail.com wrote: Having just implementing something similar for nested scopes, it turns out it can't be operators because if it was, then the names y and z would be resolved in the wrong scope. y = m z = n a = x .

Re: Rule of order for dot operators?

2015-05-19 Thread Thomas 'PointedEars' Lahn
Ned Batchelder wrote: On Tuesday, May 19, 2015 at 6:33:46 PM UTC-4, Thomas 'PointedEars' Lahn wrote: Denis McMahon wrote: On Sun, 17 May 2015 11:45:02 +1000, Steven D'Aprano wrote: On Sun, 17 May 2015 05:40 am, Thomas 'PointedEars' Lahn wrote: C.D. Reimer wrote: Who? Don't be

Re: Rule of order for dot operators?

2015-05-19 Thread Ned Batchelder
On Tuesday, May 19, 2015 at 6:33:46 PM UTC-4, Thomas 'PointedEars' Lahn wrote: Denis McMahon wrote: On Sun, 17 May 2015 11:45:02 +1000, Steven D'Aprano wrote: On Sun, 17 May 2015 05:40 am, Thomas 'PointedEars' Lahn wrote: C.D. Reimer wrote: Who? Don't be a dick, Thomas.

Re: Rule of order for dot operators?

2015-05-19 Thread Ned Batchelder
On Tuesday, May 19, 2015 at 10:26:56 PM UTC-4, Thomas 'PointedEars' Lahn wrote: And who appointed you moderator? I would not mind if you *asked* people publicly for politeness as I do that myself sometimes, but I do mind the overall tone of your off-topic comments, your apparently trying

Re: Rule of order for dot operators?

2015-05-19 Thread Steven D'Aprano
On Wed, 20 May 2015 11:36 am, Ned Batchelder wrote: Steven and Denis: you were too blunt in your objections. Fair enough. In my defence, I'm from Australia, and we're notorious for calling a spade a bloody shovel. Be considerate. Be respectful. -- Steven --

Re: Rule of order for dot operators?

2015-05-19 Thread Chris Angelico
On Wed, May 20, 2015 at 12:24 PM, Thomas 'PointedEars' Lahn pointede...@web.de wrote: And who appointed you moderator? I would not mind if you *asked* people publicly for politeness as I do that myself sometimes, but I do mind the overall tone of your off-topic comments, your apparently trying

Re: Rule of order for dot operators?

2015-05-19 Thread Thomas 'PointedEars' Lahn
Denis McMahon wrote: On Sun, 17 May 2015 11:45:02 +1000, Steven D'Aprano wrote: On Sun, 17 May 2015 05:40 am, Thomas 'PointedEars' Lahn wrote: C.D. Reimer wrote: Who? Don't be a dick, Thomas. Thomas is a professional dick, he can't help it, he's been a professional dick for years

Re: Rule of order for dot operators?

2015-05-19 Thread Ron Adam
On 05/19/2015 02:25 AM, Chris Angelico wrote: On Tue, May 19, 2015 at 12:43 PM, Ron Adamron3...@gmail.com wrote: Having just implementing something similar for nested scopes, it turns out it can't be operators because if it was, then the names y and z would be resolved in the wrong scope.

Re: Rule of order for dot operators?

2015-05-18 Thread Thomas Rachel
Am 16.05.2015 um 21:20 schrieb C.D. Reimer: Does python perform the dot operators from left to right or according to a rule of order (i.e., multiplication/division before add/subtract)? In this case, it does the only thing it can do: title = slug.replace('-',' ').title() is performed as *

Re: Rule of order for dot operators?

2015-05-18 Thread Chris Angelico
On Mon, May 18, 2015 at 3:50 AM, C.D. Reimer ch...@cdreimer.com wrote: On 5/16/2015 6:45 PM, Steven D'Aprano wrote: On Sun, 17 May 2015 05:40 am, Thomas 'PointedEars' Lahn wrote: C.D. Reimer wrote: Who? Don't be a dick, Thomas. Lots of people use their initials. You use your

Re: Rule of order for dot operators?

2015-05-18 Thread Cameron Simpson
On 16May2015 12:20, C.D. Reimer ch...@cdreimer.com wrote: title = slug.replace('-',' ').title() This line also works if I switched the dot operators around. title = slug.title().replace('-',' ') I'm reading the first example as character replacement first and title capitalization second, and

Re: Rule of order for dot operators?

2015-05-18 Thread Rustom Mody
On Tuesday, May 19, 2015 at 4:18:36 AM UTC+5:30, Cameron Simpson wrote: On 16May2015 12:20, C.D. Reimer wrote: title = slug.replace('-',' ').title() This line also works if I switched the dot operators around. title = slug.title().replace('-',' ') I'm reading the first example as character

Re: Rule of order for dot operators?

2015-05-18 Thread Ron Adam
On 05/18/2015 09:32 PM, Rustom Mody wrote: In particular, each .foo() need not return a string - it might return anything, and the following .bah() will work on that anything. For an arbitrary binary operator ◼ x ◼ y ◼ z can group as (x◼y)◼z or x◼(y◼z) One could (conceivably) apply the same

Re: Rule of order for dot operators?

2015-05-18 Thread C.D. Reimer
On 5/16/2015 6:45 PM, Steven D'Aprano wrote: On Sun, 17 May 2015 05:40 am, Thomas 'PointedEars' Lahn wrote: C.D. Reimer wrote: Who? Don't be a dick, Thomas. Lots of people use their initials. You use your nickname as part of your sender address, why are you questioning somebody for using

Re: Rule of order for dot operators?

2015-05-17 Thread Thomas 'PointedEars' Lahn
Tim Chase wrote: On 2015-05-16 12:20, C.D. Reimer wrote: Does python perform the dot operators from left to right or according to a rule of order (i.e., multiplication/division before add/subtract)? Yes, Python evaluates dot-operators from left to right. “.” is _not_ an operator in

Re: Rule of order for dot operators?

2015-05-17 Thread Thomas 'PointedEars' Lahn
C.D. Reimer wrote: On 5/16/2015 12:40 PM, Thomas 'PointedEars' Lahn wrote: However, for greater efficiency, in general you should call .replace() in such a way that the length of the string it operates on is minimized. For example, if feasible, always slice *before* .replace(). Slice was

Re: Rule of order for dot operators?

2015-05-17 Thread Ned Batchelder
On Sunday, May 17, 2015 at 1:19:59 PM UTC-4, Thomas 'PointedEars' Lahn wrote: C.D. Reimer wrote: Chris Reimer Please use this or something to that effect in your From header field value. Please stop making strange requests of others. C.D. Reimer is a perfectly reasonable name to use.

Re: Rule of order for dot operators?

2015-05-17 Thread Denis McMahon
On Sun, 17 May 2015 11:45:02 +1000, Steven D'Aprano wrote: On Sun, 17 May 2015 05:40 am, Thomas 'PointedEars' Lahn wrote: C.D. Reimer wrote: Who? Don't be a dick, Thomas. Thomas is a professional dick, he can't help it, he's been a professional dick for years in php and javascript

Re: Rule of order for dot operators?

2015-05-17 Thread Rustom Mody
On Sunday, May 17, 2015 at 11:01:01 PM UTC+5:30, Ned Batchelder wrote: On Sunday, May 17, 2015 at 1:19:59 PM UTC-4, Thomas 'PointedEars' Lahn wrote: C.D. Reimer wrote: Chris Reimer Please use this or something to that effect in your From header field value. Please stop making

Re: Rule of order for dot operators?

2015-05-17 Thread C.D. Reimer
On 5/17/2015 10:17 AM, Thomas 'PointedEars' Lahn wrote: C.D. Reimer wrote: Consider using a regular expression or the urllib object instead. See RFC 3986, Appendix B, and https://docs.python.org/3/library/urllib.html, respectively. That wouldn't work for me. I'm in the process of converting

Re: Rule of order for dot operators?

2015-05-16 Thread Peter Otten
C.D. Reimer wrote: Greetings, Noobie question regarding a single line of code that transforms a URL slug (this-is-a-slug) into a title (This Is A Slug). title = slug.replace('-',' ').title() This line also works if I switched the dot operators around. title =

Re: Rule of order for dot operators?

2015-05-16 Thread Gary Herron
On 05/16/2015 12:20 PM, C.D. Reimer wrote: Greetings, Noobie question regarding a single line of code that transforms a URL slug (this-is-a-slug) into a title (This Is A Slug). title = slug.replace('-',' ').title() This line also works if I switched the dot operators around. title =

Re: Rule of order for dot operators?

2015-05-16 Thread C.D. Reimer
On 5/16/2015 12:34 PM, Peter Otten wrote: You can find out yourself by using operations where the order does matter: Test.upper().lower() I was wondering about that and couldn't think of an example off the top of my head. Thank you, Chris Reimer --

Re: Rule of order for dot operators?

2015-05-16 Thread Tim Chase
On 2015-05-16 12:20, C.D. Reimer wrote: Does python perform the dot operators from left to right or according to a rule of order (i.e., multiplication/division before add/subtract)? Yes, Python evaluates dot-operators from left to right. -tkc --

Rule of order for dot operators?

2015-05-16 Thread C.D. Reimer
Greetings, Noobie question regarding a single line of code that transforms a URL slug (this-is-a-slug) into a title (This Is A Slug). title = slug.replace('-',' ').title() This line also works if I switched the dot operators around. title = slug.title().replace('-',' ') I'm reading the

Re: Rule of order for dot operators?

2015-05-16 Thread Joel Goldstick
On Sat, May 16, 2015 at 3:20 PM, C.D. Reimer ch...@cdreimer.com wrote: Greetings, Noobie question regarding a single line of code that transforms a URL slug (this-is-a-slug) into a title (This Is A Slug). title = slug.replace('-',' ').title() This line also works if I switched the dot

Re: Rule of order for dot operators?

2015-05-16 Thread Thomas 'PointedEars' Lahn
C.D. Reimer wrote: Who? Noobie What? question regarding a single line of code that transforms a URL slug (this-is-a-slug) into a title (This Is A Slug). title = slug.replace('-',' ').title() This line also works if I switched the dot operators around. title =

Re: Rule of order for dot operators?

2015-05-16 Thread C.D. Reimer
On 5/16/2015 12:40 PM, Thomas 'PointedEars' Lahn wrote: However, for greater efficiency, in general you should call .replace() in such a way that the length of the string it operates on is minimized. For example, if feasible, always slice *before* .replace(). Slice was how I got the slug from

Re: Rule of order for dot operators?

2015-05-16 Thread Steven D'Aprano
On Sun, 17 May 2015 05:20 am, C.D. Reimer wrote: Greetings, Noobie question regarding a single line of code that transforms a URL slug (this-is-a-slug) into a title (This Is A Slug). title = slug.replace('-',' ').title() This line also works if I switched the dot operators around.

Re: Rule of order for dot operators?

2015-05-16 Thread Steven D'Aprano
On Sun, 17 May 2015 05:40 am, Thomas 'PointedEars' Lahn wrote: C.D. Reimer wrote: Who? Don't be a dick, Thomas. Lots of people use their initials. You use your nickname as part of your sender address, why are you questioning somebody for using their initials? Noobie What? Where?

Re: Rule of order for dot operators?

2015-05-16 Thread Rustom Mody
On Sunday, May 17, 2015 at 7:15:13 AM UTC+5:30, Steven D'Aprano wrote: On Sun, 17 May 2015 05:40 am, Thomas 'PointedEars' Lahn wrote: C.D. Reimer wrote: Who? Don't be a dick, Thomas. Lots of people use their initials. You use your nickname as part of your sender address, why are