Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.096 X-Spam-Evidence: '*H*': 0.81; '*S*': 0.00; 'correct.': 0.07; 'second.': 0.09; 'python': 0.11; 'subject:operators': 0.16; 'wrote:': 0.18; 'example': 0.22; 'header:User-Agent:1': 0.23; 'switched': 0.24; 'question': 0.24; 'second': 0.26; 'header:In- Reply-To:1': 0.27; 'chris': 0.29; 'character': 0.29; "i'm": 0.30; 'code': 0.31; 'gary': 0.31; 'operators': 0.31; 'second,': 0.31; 'subject:?': 0.36; 'thank': 0.38; '(i.e.,': 0.38; 'to:addr:python- list': 0.38; 'pm,': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'according': 0.40; 'around.': 0.60; 'first': 0.61; 'charset:windows-1252': 0.65; 'institute': 0.72; 'received:204': 0.75; 'dr.': 0.77; '("this': 0.84 Date: Sat, 16 May 2015 12:32:45 -0700 From: Gary Herron User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Rule of order for dot operators? References: <55579886.3010001@cdreimer.com> In-Reply-To: <55579886.3010001@cdreimer.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ 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: 37 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1431804776 news.xs4all.nl 2948 [2001:888:2000:d::a6]:33436 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:90752 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 = slug.title().replace('-',' ') > > I'm reading the first example as character replacement first and title > capitalization second, and the second example as title capitalization > first and character replacement second. > > 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, that's correct. Gary Herron > > Thank you, > > Chris Reimer -- Dr. Gary Herron Department of Computer Science DigiPen Institute of Technology (425) 895-4418