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


Groups > comp.lang.python > #90751

Rule of order for dot operators?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <chris@cdreimer.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.070
X-Spam-Evidence '*H*': 0.86; '*S*': 0.00; 'second.': 0.09; 'python': 0.11; 'subject:operators': 0.16; 'example': 0.22; 'header:User- Agent:1': 0.23; 'from:addr:chris': 0.24; 'switched': 0.24; 'question': 0.24; 'second': 0.26; 'chris': 0.29; 'character': 0.29; "i'm": 0.30; 'code': 0.31; 'received:10.0.0': 0.31; 'operators': 0.31; 'received:66.33': 0.31; 'received:66.33.216': 0.31; 'received:66.33.216.122': 0.31; 'received:dreamhost.com': 0.31; 'received:g.dreamhost.com': 0.31; 'received:hapkido.dreamhost.com': 0.31; 'second,': 0.31; 'received:66': 0.35; 'subject:?': 0.36; 'received:10.0': 0.36; 'received:10': 0.37; 'thank': 0.38; '(i.e.,': 0.38; 'to:addr :python-list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'according': 0.40; 'around.': 0.60; 'first': 0.61; '("this': 0.84
DKIM-Signature v=1; a=rsa-sha1; c=relaxed; d=cdreimer.com; h=message-id :date:from:mime-version:to:subject:content-type :content-transfer-encoding; s=cdreimer.com; bh=ztMlk4c2ksBag0dmw lN/Tz5CZ1U=; b=wEdjlFczrVdcDQ179sz7xDT2m5c6H2InrDwJIxHBFmJKmfvKa UioigzgwNQAE4esLMUvtPTSLSwDbVyrxCFY8oDT8zioPZ4v5A9QQWKI8jtuoIr0M STPgv/a0Prrvys6z+zfPkpCiij+J22TdlNlJYrDllsbNtAOdKp47nJy6w0=
Date Sat, 16 May 2015 12:20:38 -0700
From "C.D. Reimer" <chris@cdreimer.com>
User-Agent Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0
MIME-Version 1.0
To python-list@python.org
Subject Rule of order for dot operators?
Content-Type text/plain; charset=utf-8; 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 <python-list.python.org>
List-Unsubscribe <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.80.1431804386.17265.python-list@python.org> (permalink)
Lines 21
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1431804386 news.xs4all.nl 2900 [2001:888:2000:d::a6]:58413
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:90751

Show key headers only | View raw


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)?

Thank you,

Chris Reimer

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Rule of order for dot operators? "C.D. Reimer" <chris@cdreimer.com> - 2015-05-16 12:20 -0700
  Re: Rule of order for dot operators? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-05-16 21:40 +0200
    Re: Rule of order for dot operators? "C.D. Reimer" <chris@cdreimer.com> - 2015-05-16 12:55 -0700
      Re: Rule of order for dot operators? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-05-17 19:17 +0200
        Re: Rule of order for dot operators? Ned Batchelder <ned@nedbatchelder.com> - 2015-05-17 10:30 -0700
          Re: Rule of order for dot operators? Rustom Mody <rustompmody@gmail.com> - 2015-05-17 12:13 -0700
        Re: Rule of order for dot operators? "C.D. Reimer" <chris@cdreimer.com> - 2015-05-17 11:35 -0700
    Re: Rule of order for dot operators? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-05-17 11:45 +1000
      Re: Rule of order for dot operators? Rustom Mody <rustompmody@gmail.com> - 2015-05-16 22:06 -0700
      Re: Rule of order for dot operators? Denis McMahon <denismfmcmahon@gmail.com> - 2015-05-17 15:43 +0000
        Re: Rule of order for dot operators? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-05-20 00:30 +0200
          Re: Rule of order for dot operators? Ned Batchelder <ned@nedbatchelder.com> - 2015-05-19 18:36 -0700
            Re: Rule of order for dot operators? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-05-20 04:24 +0200
              Re: Rule of order for dot operators? Ned Batchelder <ned@nedbatchelder.com> - 2015-05-19 19:44 -0700
              Re: Rule of order for dot operators? Chris Angelico <rosuav@gmail.com> - 2015-05-20 13:11 +1000
              Re: Rule of order for dot operators? Ben Finney <ben+python@benfinney.id.au> - 2015-05-20 17:29 +1000
            Re: Rule of order for dot operators? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-05-20 12:31 +1000
      Re: Rule of order for dot operators? "C.D. Reimer" <chris@cdreimer.com> - 2015-05-17 10:50 -0700
      Re: Rule of order for dot operators? Chris Angelico <rosuav@gmail.com> - 2015-05-18 17:40 +1000
  Re: Rule of order for dot operators? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-05-17 11:31 +1000
  Re: Rule of order for dot operators? Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2015-05-18 14:00 +0200

csiph-web